Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

gracejo

macrumors newbie
Original poster
Jan 9, 2012
5
0
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"];

}
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.