views:

14

answers:

1

I have the following:

- (NSInteger) numberOfComponentsInPickerView:(UIPickerView *)pickerView {
      return 2;
}

- (NSInteger) pickerView:(UIPickerView *) pickerView numberOfRowsInComponent:(NSInteger) component {
      return [genderPickerData count];
      return [agePickerData count];
}

When I do this, the UIPicker is split into 2 components, but the PickerData is only being represented for gender on both pickers. I am trying to figure out through Apple's confusing documentation on how I reference each individual component but can't seem to figure it out.

A: 

The component is right there in the arguments of the delegate method:

- (NSInteger) pickerView:(UIPickerView *) pickerView numberOfRowsInComponent:(NSInteger) component {
    if (component == 0) {
        return [genderPickerData count];
    } else {
        return [agePickerData count];
    }
}
Ole Begemann