Reputation: 183
I have 4 components in PickerView. I want to select the complete row in all the components when row 0 of component 0 is selected. Similarly, for every other row of each components. Is there any way to extend the single selection for all?
Any help would be appreciated.
Upvotes: 0
Views: 85
Reputation: 318924
Implement the UIPickerView
delegate method pickerView:didSelectRow:inComponent:
.
// called when a user selects a row
- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
// This code assumes all four components have the same number of rows
for (NSInteger c = 0; c < pickerView.numberOfComponent; c++) {
if (c != component) {
[pickerView selectRow:row inComponent:c animated:NO]; // animate if desired
}
}
// do any other desired actions (if any) when a row is selected
}
Another option would be to have just one component showing all four sets of data in each row. Having 4 components doesn't make a lot of sense if the user can't ever select different values for each component.
Upvotes: 1