Search code examples
iphonexcodeuipickerview

How do I attach an action to a UIPicker change?


Im trying to update an UIImageView with a color based on data set in a UIPicker. How do I do it on the action of the Picker's data changing?

e.g., the user spins a component in the picker, and the change in data is automatically sent.


Solution

  • You need to implement the delegate method for the pickerView – pickerView:didSelectRow:inComponent: That gets called anytime the pickerView changes and it is where you would perform your "action" after a change.