user1236867
user1236867

Reputation: 33

UIPickerView intercepting user selections

I have a UIPickerView with two components each with 10 rows being loaded from individual NSArrays.

I need to be able to intercept the users selection, perform an equation (using the index of the current selection and the index of the selection the user just made) and then set either one or both components selections.

I can't for the life of me work out how to implement the methods;

to a. store the selected row in a variable so i can use it in the equation with the next selected value. and b. to have the program change the users input based off the equation.

Upvotes: 2

Views: 149

Answers (1)

Peter Cetinski
Peter Cetinski

Reputation: 2336

When working with a UIPickerView you need to implement the UIPickerViewDelegate protocol. In your case, you need to be concerned with the pickerView:didSelectRow:inComponent: method which will be called every time a user makes a selection on your picker components.

Upvotes: 1

Related Questions