views:

8

answers:

0

Hello,

In my application i have to design a form which includes 21 controls.From this 21 controls 12 controls need to act as a drop down. As there is no inbuilt facility of drop down in iphone sdk so i have to use pickerview. So for this 12 control i have changed their look like drop down by adding image in right mode. In viewdidload method i have added pickerview and hide it by default. Now when i start to edit any control from this 12 drop down control i unhide this picker view with respective data source and delegate so it shows respective picker with respective data for this 12 drop down control. Now my problem is my certain drop down are visible only when we scroll down.So for them if i click to show picker view the contorl itself hide behind picker same like textfield hide behind keyboard.

As a solution i have try to increate the height of scrollview by adding height of pickerview and move up the scrollview exactly as the height of pickerview. Its work okay as when my drop down control located at bottom part of the iphone screen and when i click on it scrollview moves up to make it visible and picker view is visible at bottom.

Now my problem is suppose user scroll up one of the drop down control which lies in the bottom of the screen and now if user click on the that drop down control, the control moves up further as it is already visible because user has scroll up it. So in this case visible control moves up further and hide and show picker view.

In short i want same functionality like uitextfield and keyboard show/hide with uitextfield pickerview show hide on scrollview.

I am googling since last two weeks but unfortunately not finding any suitable solutions.

Please help.

My code is

import "AddViewController.h"

import "RentalViewController.h"

//#define SCROLLVIEW_CONTENT_HEIGHT 460 //#define SCROLLVIEW_CONTENT_HEIGHT 950 //#define SCROLLVIEW_CONTENT_WIDTH 320

CGFloat animatedDistance; static const CGFloat KEYBOARD_ANIMATION_DURATION = 0.3; static const CGFloat MINIMUM_SCROLL_FRACTION = 0.2; static const CGFloat MAXIMUM_SCROLL_FRACTION = 0.8; static const CGFloat PORTRAIT_KEYBOARD_HEIGHT = 216; static const CGFloat LANDSCAPE_KEYBOARD_HEIGHT = 162;

define kOFFSET_FOR_KEYBOARD 160.0

@implementation AddViewController

@synthesize rentalViewSignOut;

@synthesize txtAppName; @synthesize txtAppAddress; @synthesize txtSquareFeet,txtLeasePeriod,txtTransitNotes,txtTags,txtCustomNotes; @synthesize txtNoOfBedroom,txtHeating,txtHotWater,txtElectricity,txtDishWasher,txtFoodDisposal,txtMicrowave,txtWasherDryer,txtFridge,txtPantry,txtCloackRoom,txtParking;

@synthesize scrollView; @synthesize thePickerView; @synthesize pickerData,noofbedroom,heating,hotwater; @synthesize electricity,dishwasher,fooddisposal,microwave,washerdryer,fridge,pantry,cloakroom,parking;

  • (void)viewDidLoad { scrollView.frame = CGRectMake(0, 88, 320, 460); [scrollView setContentSize:CGSizeMake(320, 1100)];

    thePickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,200,320,216)]; [self.view addSubview:thePickerView]; thePickerView.showsSelectionIndicator = YES;
    thePickerView.hidden = YES;

    [self viewWillAppear:YES]; txtNoOfBedroom.delegate = self; txtHeating.delegate = self; txtHotWater.delegate = self;

    txtElectricity.delegate = self; txtDishWasher.delegate = self; txtFoodDisposal.delegate = self; txtMicrowave.delegate = self; txtWasherDryer.delegate = self; txtFridge.delegate = self; txtPantry.delegate = self; txtCloackRoom.delegate = self; txtParking.delegate = self;

    indicator1 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator2 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator3 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]];

    indicator4 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator5 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator6 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator7 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator8 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator9 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator10 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator11 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]]; indicator12 = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @"downArrow.png"]];

    [txtNoOfBedroom setRightViewMode:UITextFieldViewModeAlways]; [txtNoOfBedroom setRightView:indicator1];

    [txtHeating setRightViewMode:UITextFieldViewModeAlways]; [txtHeating setRightView:indicator2];

    [txtHotWater setRightViewMode:UITextFieldViewModeAlways]; [txtHotWater setRightView:indicator3];

    [txtElectricity setRightViewMode:UITextFieldViewModeAlways]; [txtElectricity setRightView:indicator4];

    [txtDishWasher setRightViewMode:UITextFieldViewModeAlways]; [txtDishWasher setRightView:indicator5];

    [txtFoodDisposal setRightViewMode:UITextFieldViewModeAlways]; [txtFoodDisposal setRightView:indicator6];

    [txtMicrowave setRightViewMode:UITextFieldViewModeAlways]; [txtMicrowave setRightView:indicator7];

    [txtWasherDryer setRightViewMode:UITextFieldViewModeAlways]; [txtWasherDryer setRightView:indicator8];

    [txtFridge setRightViewMode:UITextFieldViewModeAlways]; [txtFridge setRightView:indicator9];

    [txtPantry setRightViewMode:UITextFieldViewModeAlways]; [txtPantry setRightView:indicator10];

    [txtCloackRoom setRightViewMode:UITextFieldViewModeAlways]; [txtCloackRoom setRightView:indicator11];

    [txtParking setRightViewMode:UITextFieldViewModeAlways]; [txtParking setRightView:indicator12];

    [indicator1 release];

    txtNoOfBedroom.text = @"--"; txtHeating.text = @"--"; txtHotWater.text = @"--";

    txtElectricity.text = @"--"; txtDishWasher.text = @"--"; txtFoodDisposal.text = @"--"; txtMicrowave.text = @"--"; txtWasherDryer.text = @"--"; txtFridge.text = @"--"; txtPantry.text = @"--"; txtCloackRoom.text = @"--"; txtParking.text = @"--";

    noofbedroom = [[NSArray alloc] initWithObjects:@"--",@"1", @"2",@"3", @"4",@"4+", nil]; heating = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; hotwater = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil];

    electricity = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; dishwasher = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; fooddisposal = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; microwave = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; washerdryer = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; fridge = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; pantry = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; cloakroom = [[NSArray alloc] initWithObjects:@"--",@"Included", @"Not Included",nil]; parking = [[NSArray alloc] initWithObjects:@"--",@"covered garage", @"assigned", @"on street", @"not available",nil];

    [super viewDidLoad]; }

-(void) viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (keyboardDidShow:) name: UIKeyboardDidShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector (keyboardDidHide:) name: UIKeyboardDidHideNotification object:nil];

displayKeyboard = NO;

}

-(void) viewWillDisappear:(BOOL)animated { [[NSNotificationCenter defaultCenter] removeObserver:self]; }

  • (void)keyboardDidShow:(NSNotification *)notif { if (displayKeyboard) {
    return; }

    NSDictionary* info = [notif userInfo]; NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey]; CGSize keyboardSize = [aValue CGRectValue].size;

    CGRect viewFrame = self.view.frame; viewFrame.size.height -= keyboardSize.height; viewFrame.origin.y = 39; scrollView.frame = viewFrame;

    displayKeyboard = YES; }

    • (void)keyboardDidHide:(NSNotification *)notif { if (!displayKeyboard) { return; }

    NSDictionary* info = [notif userInfo];

    NSValue* aValue = [info objectForKey:UIKeyboardBoundsUserInfoKey]; CGSize keyboardSize = [aValue CGRectValue].size;

    CGRect viewFrame = self.view.frame; viewFrame.size.height += keyboardSize.height; viewFrame.origin.y = 39; scrollView.frame = viewFrame;

    displayKeyboard = NO;

}
/* - (void)textFieldDidBeginEditing:(UITextField *)textField { CGRect textFieldRect = [self.view.window convertRect:textField.bounds fromView:textField]; CGRect viewRect = [self.view.window convertRect:self.view.bounds fromView:self.view];

CGFloat midline = textFieldRect.origin.y + 0.5 * textFieldRect.size.height;
CGFloat numerator = midline - viewRect.origin.y - MINIMUM_SCROLL_FRACTION * viewRect.size.height;
CGFloat denominator = (MAXIMUM_SCROLL_FRACTION - MINIMUM_SCROLL_FRACTION) * viewRect.size.height;
CGFloat heightFraction = numerator / denominator;

if (heightFraction < 0.0)
{
    heightFraction = 0.0;
}
else if (heightFraction > 1.0)
{
    heightFraction = 1.0;
}

UIInterfaceOrientation orientation =
[[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationPortrait ||
    orientation == UIInterfaceOrientationPortraitUpsideDown)
{
    animatedDistance = floor(PORTRAIT_KEYBOARD_HEIGHT * heightFraction);
}
else
{
    animatedDistance = floor(LANDSCAPE_KEYBOARD_HEIGHT * heightFraction);
}

CGRect viewFrame = self.view.frame;
viewFrame.origin.y -= animatedDistance;

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDuration:KEYBOARD_ANIMATION_DURATION];

[self.view setFrame:viewFrame];

[UIView commitAnimations];

} / / - (void)textFieldDidBeginEditing:(UITextField *)textField { printf("Hello"); [self animateTextField: textField up: YES]; } / / - (void)textFieldDidEndEditing:(UITextField *)textField { [self animateTextField: textField up: NO]; } */

-(void) touchesBegan :(NSSet *) touches withEvent:(UIEvent *)event

{

UITouch *touch = [[event allTouches] anyObject];
if ([txtAppName isFirstResponder] && [touch view] != txtAppName) {
    [scrollView resignFirstResponder];
}
[super touchesBegan:touches withEvent:event];

}

  • (IBAction)textFieldDoneEditing:(id)sender { [sender resignFirstResponder]; }
  • (IBAction)backgroundTapAdd:(id)sender { [txtAppName resignFirstResponder]; [txtAppAddress resignFirstResponder]; }

  • (void) animateTextField: (UITextField*) textField up: (BOOL) up { const int movementDistance = 80; // tweak as needed const float movementDuration = 0.3f; // tweak as needed

    int movement = (up ? -movementDistance : movementDistance);

    [UIView beginAnimations: @"anim" context: nil]; [UIView setAnimationBeginsFromCurrentState: YES]; [UIView setAnimationDuration: movementDuration]; self.view.frame = CGRectOffset(self.view.frame, 0, movement); [UIView commitAnimations]; }

  • (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
    {

    if ([textField isEqual:txtNoOfBedroom]) { if(thePickerView.hidden == NO) {

        thePickerView.hidden = YES;
    
    
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];
        thePickerView.hidden = NO;
    }
    

// UIPickerView *thePickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,172,320,216)]; thePickerView.dataSource = self; thePickerView.delegate = self; // thePickerView.showsSelectionIndicator = YES;

// [self.view addSubview:thePickerView]; self.pickerData = noofbedroom;

/*
CGRect rect = thePickerView.frame; CGPoint origin = CGPointMake(0, 100); // Some off-screen y-offset here.

    rect.origin = origin;
    thePickerView.frame = rect;

    // Perform transform to slide it onto the screen.
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.5];
    thePickerView.transform = CGAffineTransformMakeTranslation(0, 100); // Offset.
    [UIView commitAnimations];

*/

    return NO;
}

else if ([textField isEqual:txtHeating])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }
//  txtHeating.userInteractionEnabled = NO;
    thePickerView.dataSource = self;
    thePickerView.delegate = self;
    thePickerView.showsSelectionIndicator = YES;
    self.pickerData = heating;

    CGRect rect = thePickerView.frame;
    CGRect rect1 = scrollView.frame;

    printf("@=%f",rect1.size.height);
    rect1.size.height += rect.size.height;

    printf("@=%f",rect1.size.height);

    float pickerHeight = rect.size.height;
    CGPoint origin = CGPointMake(0,-100 ); // Some off-screen y-offset here.


//  rect.origin = origin;
//  thePickerView.frame = rect;
    rect1.origin = origin;
    scrollView.frame = rect1;


    return NO;
}

else if ([textField isEqual:txtHotWater])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    thePickerView.dataSource = self;
    thePickerView.delegate = self;
    self.pickerData = hotwater;

    return NO;
}   

else if ([textField isEqual:txtElectricity])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    thePickerView.dataSource = self;
    thePickerView.delegate = self;
    thePickerView.showsSelectionIndicator = YES;

    self.pickerData = electricity;

    return NO;
}   
else if ([textField isEqual:txtDishWasher])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    thePickerView.dataSource = self;
    thePickerView.delegate = self;
    thePickerView.showsSelectionIndicator = YES;

    self.pickerData = dishwasher;

    return NO;
}   
else if ([textField isEqual:txtFoodDisposal])
{
    thePickerView.dataSource = self;
    thePickerView.delegate = self;
    thePickerView.showsSelectionIndicator = YES;

    self.pickerData = fooddisposal;
    return NO;
}   
else if ([textField isEqual:txtMicrowave])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    thePickerView.dataSource = self;
    thePickerView.delegate = self;

    self.pickerData = microwave;

    return NO;
}   
else if ([textField isEqual:txtWasherDryer])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }
    thePickerView.dataSource = self;
    thePickerView.delegate = self;

    self.pickerData = washerdryer;
    return NO;
}   
else if ([textField isEqual:txtFridge])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    thePickerView.dataSource = self;
    thePickerView.delegate = self;
    self.pickerData = fridge;
    return NO;
}   
else if ([textField isEqual:txtPantry])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    thePickerView.dataSource = self;
    thePickerView.delegate = self;

    self.pickerData = pantry;

    return NO;
}   
else if ([textField isEqual:txtCloackRoom])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {

        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    txtCloackRoom.userInteractionEnabled = NO;
    thePickerView.dataSource = self;
    thePickerView.delegate = self;

    self.pickerData = cloakroom;
    return NO;
}   
else if ([textField isEqual:txtParking])
{
    if(thePickerView.hidden == NO)
    {  
        thePickerView.hidden = YES;
    }   
    else 
    {
        [txtAppName resignFirstResponder];
        [txtAppAddress resignFirstResponder];
        [txtSquareFeet resignFirstResponder];
        [txtLeasePeriod resignFirstResponder];
        [txtTransitNotes resignFirstResponder];
        [txtTags resignFirstResponder];
        [txtCustomNotes resignFirstResponder];

        thePickerView.hidden = NO;
    }

    thePickerView.dataSource = self;
    thePickerView.delegate = self;

    self.pickerData = parking;
    return NO;
}   

else
{
    if(thePickerView.hidden == NO)
    { 

        thePickerView.hidden = YES;
    }   
    return YES;
}   

}

  • (IBAction) commonSignOut:(id) sender { // [super viewDidLoad];

    UIView *frontView = [[self tabBarController] view]; UIView *containerView = [frontView superview];

    rentalViewSignOut = [[RentalViewController alloc]initWithNibName:@"RentalViewController" bundle:nil];

    [containerView addSubview:rentalViewSignOut.view]; [frontView removeFromSuperview]; } /* -(BOOL) textFieldShouldReturn:(UITextField *) textFieldView {
    [textFieldView resignFirstResponder]; return NO; } */

    • (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview.

    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use. }

    • (void)viewDidUnload {

    self.rentalViewSignOut = nil;
    self.pickerData = nil; self.noofbedroom = nil; self.heating = nil; self.hotwater = nil; self.electricity = nil; self.dishwasher = nil; self.fooddisposal = nil; self.microwave = nil; self.washerdryer = nil; self.fridge = nil; self.pantry = nil; self.cloakroom = nil; self.parking = nil;

    [super viewDidUnload]; }

    • (void)dealloc { [rentalViewSignOut release]; [scrollView release]; [pickerData release]; [noofbedroom release]; [heating release]; [hotwater release]; [electricity release]; [dishwasher release]; [fooddisposal release]; [microwave release]; [washerdryer release]; [fridge release]; [pantry release]; [cloakroom release]; [parking release];

    [super dealloc]; }

    pragma mark -

pragma mark Picker Data Source Methods

  • (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { return 1; }
  • (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [pickerData count]; }

    pragma mark Picker Delegate Methods

  • (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { if (pickerData == noofbedroom) return [noofbedroom objectAtIndex:row]; else if (pickerData == heating) return [heating objectAtIndex:row]; else if (pickerData == hotwater) return [hotwater objectAtIndex:row]; else if (pickerData == electricity) return [electricity objectAtIndex:row]; else if (pickerData == dishwasher) return [dishwasher objectAtIndex:row]; else if (pickerData == fooddisposal) return [fooddisposal objectAtIndex:row]; else if (pickerData == microwave) return [microwave objectAtIndex:row]; else if (pickerData == washerdryer) return [washerdryer objectAtIndex:row]; else if (pickerData == fridge) return [fridge objectAtIndex:row]; else if (pickerData == pantry) return [pantry objectAtIndex:row]; else if (pickerData == cloakroom) return [cloakroom objectAtIndex:row]; else if (pickerData == parking) return [parking objectAtIndex:row]; else NSLog(@"Delegate else");

}

  • (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {

    if (pickerData == noofbedroom) txtNoOfBedroom.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == heating) txtHeating.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == hotwater) txtHotWater.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == electricity) txtElectricity.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == dishwasher) txtDishWasher.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == fooddisposal) txtFoodDisposal.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == microwave) txtMicrowave.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == washerdryer) txtWasherDryer.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == fridge) txtFridge.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == pantry) txtPantry.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == cloakroom) txtCloackRoom.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else if (pickerData == parking) txtParking.text = [self.pickerData objectAtIndex:[pickerView selectedRowInComponent:0]]; else NSLog(@"No Pickerview"); } @end