开发者

iPhone Picker Help

I have a picker setup, and it is displaying the outp开发者_如何学JAVAut 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.


You should be able to use the didSelectRow method. Once a row is selected that method will run.

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPickerViewDelegate_Protocol/Reference/UIPickerViewDelegate.html

This does not work so well with multiple components as once one component is selected it grabs the values for all of them.


Implement a UIPickerViewDelegate, and then you can use the appropriate callback method to modify your label (probably pickerView:didSelectRow:inComponent:). See this link.


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:.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜