Mineeee
Mineeee

Reputation: 1

update a uipicker

I have two columns, in the uipicker. When I select something from the first column, I want the options to change on the other column.

Source code anyone?

Thanks a bunch

Upvotes: 0

Views: 176

Answers (2)

Saurabh
Saurabh

Reputation: 22873

try something like this -

- (void)pickerView:(UIPickerView *)pickerView
      didSelectRow:(NSInteger)row
       inComponent:(NSInteger)component {
    if (component == 0) {

        //Here First Part of the Pickerview is represented using 0.
        // dependentPicker is the Pickerview outlet

        [dependentPicker selectRow:row inComponent:1 animated:YES];
        [dependentPicker reloadComponent:1];
    }
    else
    {
        [dependentPicker selectRow:row inComponent:0 animated:YES];
        [dependentPicker reloadComponent:1];
    }
}

Upvotes: 0

coderjoe
coderjoe

Reputation: 147

Check out the book 'Iphone 4 development' from Apress, at chapter 7 there is made a dependent picker, the one that you want to make (it's called a dependent uipickerview).

Upvotes: 0

Related Questions