Reputation: 2527
I have a picker setup, and it is displaying the output of the picker to a label. However, I have to click a button for that too happen. How can I display the picker contents a user is selecting without having to hit a button.
Edit: I forgot to mention that my picker has two columns. If anyone has code examples that would be great.
Upvotes: 0
Views: 158
Reputation: 319
You should be able to use the didSelectRow method. Once a row is selected that method will run.
This does not work so well with multiple components as once one component is selected it grabs the values for all of them.
Upvotes: 1
Reputation: 2226
To perform an action when the user selects a row in UIPickerView, you need to set the pikcerview's delegate and implement – pickerView:didSelectRow:inComponent:
.
Upvotes: 0
Reputation: 41
Implement a UIPickerViewDelegate, and then you can use the appropriate callback method to modify your label (probably pickerView:didSelectRow:inComponent:). See this link.
Upvotes: 0