I am just learning how to setup a multiple picker and I am a little curious about the two labeled sections below:
// METHOD_001
NSInteger row_001 = [doublePicker selectedRowInComponent:0];
NSInteger row_002 = [doublePicker selectedRowInComponent:1];
NSString *selected_001 = [pickerData_001 objectAtIndex:row_001];
NSString *selected_002 = [pickerData_002 objectAtIndex:row_002];
EDIT_001:
Maybe if I simplify this a little .... I know what METHOD_001 is doing, but what about the method below. If I comment it out my code still runs but the picker UI does not get populated with my data, so its obviously involved in taking data from the dataSource so the picker can display it. One puzzling aspect is that it uses "objectAtIndex:row" to access an item, even though the whole UI needs populating (i.e. all the rows) Does this then mean that this gets called for each row, seems funny that it does not take a NSArray nd populated the picker UI in one shot?
// DELEGATE
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
if(component == kCoffeeIndex) return [pickerData_001 objectAtIndex:row];
return [pickerData_002 objectAtIndex:row];
}
gary