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)numberOfComponentsInPickerViewUIPickerView *) thePickerView {
return 1;
}
-(NSInteger)pickerViewUIPickerView *) thePickerView numberOfRowsInComponentNSInteger)component
{
return [list count];
}
-(NSString*)pickerViewUIPickerView *) thePickerView titleForRowNSInteger)row forComponentNSInteger)component {
return [list objectAtIndex:row];
}
//-(void)pickerViewUIPickerView *) thePickerView didSelectRowNSInteger)row inComponentNSInteger)component {
// NSLog(@"Selected Items :%@, Index of Selected item: %@", [list objectAtIndex:row], row);
//}
-(NSInteger)numberOfComponentsInPickerViewHistoryUIPickerView *) thePickerViewHistory {
return 1;
}
-(NSInteger)pickerViewHistoryUIPickerView *) thePickerViewHistory numberOfRowsInComponentNSInteger)component
{
return [historyDates count];
}
-(NSString*)pickerViewHistoryUIPickerView *) thePickerViewHistory titleForRowNSInteger)row forComponentNSInteger)component {
return [historyDates objectAtIndex:row];
}
- (void)viewDidLoad
{
[super viewDidLoad];
list = [[NSMutableArray alloc] init];
[list addObject"Temperature"];
[list addObject"Humility"];
[list addObject"Light"];
historyDates = [[NSMutableArray alloc] init];
[historyDates addObject"3 days ago"];
[historyDates addObject"2 days ago"];
[historyDates addObject"1 day ago"];
}
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)numberOfComponentsInPickerViewUIPickerView *) thePickerView {
return 1;
}
-(NSInteger)pickerViewUIPickerView *) thePickerView numberOfRowsInComponentNSInteger)component
{
return [list count];
}
-(NSString*)pickerViewUIPickerView *) thePickerView titleForRowNSInteger)row forComponentNSInteger)component {
return [list objectAtIndex:row];
}
//-(void)pickerViewUIPickerView *) thePickerView didSelectRowNSInteger)row inComponentNSInteger)component {
// NSLog(@"Selected Items :%@, Index of Selected item: %@", [list objectAtIndex:row], row);
//}
-(NSInteger)numberOfComponentsInPickerViewHistoryUIPickerView *) thePickerViewHistory {
return 1;
}
-(NSInteger)pickerViewHistoryUIPickerView *) thePickerViewHistory numberOfRowsInComponentNSInteger)component
{
return [historyDates count];
}
-(NSString*)pickerViewHistoryUIPickerView *) thePickerViewHistory titleForRowNSInteger)row forComponentNSInteger)component {
return [historyDates objectAtIndex:row];
}
- (void)viewDidLoad
{
[super viewDidLoad];
list = [[NSMutableArray alloc] init];
[list addObject"Temperature"];
[list addObject"Humility"];
[list addObject"Light"];
historyDates = [[NSMutableArray alloc] init];
[historyDates addObject"3 days ago"];
[historyDates addObject"2 days ago"];
[historyDates addObject"1 day ago"];
}