1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

2 picker views

Discussion in 'iPad Apps' started by gracejo, Jan 9, 2012.

  1. macrumors newbie

    #1
    how do i place 2 picker views into a page itself?
    i tried, 2 picker views is inserted but the objects that i added appears the same. but i coded it differently. did i code wrongly?



    -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *) thePickerView {
    return 1;
    }
    -(NSInteger)pickerView:(UIPickerView *) thePickerView numberOfRowsInComponent:(NSInteger)component
    {
    return [list count];
    }

    -(NSString*)pickerView:(UIPickerView *) thePickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    return [list objectAtIndex:row];
    }

    //-(void)pickerView:(UIPickerView *) thePickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
    // NSLog(@"Selected Items :%@, Index of Selected item: %@", [list objectAtIndex:row], row);
    //}

    -(NSInteger)numberOfComponentsInPickerViewHistory:(UIPickerView *) thePickerViewHistory {
    return 1;
    }
    -(NSInteger)pickerViewHistory:(UIPickerView *) thePickerViewHistory numberOfRowsInComponent:(NSInteger)component
    {
    return [historyDates count];
    }

    -(NSString*)pickerViewHistory:(UIPickerView *) thePickerViewHistory titleForRow:(NSInteger)row forComponent:(NSInteger)component {
    return [historyDates objectAtIndex:row];
    }






    - (void)viewDidLoad
    {
    [super viewDidLoad];

    list = [[NSMutableArray alloc] init];
    [list addObject:mad:"Temperature"];
    [list addObject:mad:"Humility"];
    [list addObject:mad:"Light"];


    historyDates = [[NSMutableArray alloc] init];
    [historyDates addObject:mad:"3 days ago"];
    [historyDates addObject:mad:"2 days ago"];
    [historyDates addObject:mad:"1 day ago"];

    }
     

Share This Page