如何设置 UIPickerView 的当前选择
我在一个 xib 文件中有一个选择器视图,在另一个文件中有一个地图视图。用户使用选择器视图选择地图视图,然后单击按钮加载地图视图。但是,当我返回到选取器视图 xib 文件时,选取器视图将返回到默认选择。如何让picker view自动选择用户之前选择的mapView?
I have a picker View in one xib file, and a map View in another. The user selects a map view with the picker View, and the clicks a button, which loads the mapView. However, when I return to the picker View xib file, the picker View goes back to the default selection. How do I make the picker view automatically select the mapView that the user selected before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您离开 XIB 时存储选择,当您返回时只需告诉它重新选择即可。
http://developer.apple.com/iphone/library/documentation/uikit/reference/UIPickerView_Class/Reference/UIPickerView.html#//apple_ref/occ/instm/UIPickerView/selectRow:inComponent:animated< /a>:
Store the selection when you hop away from the XIB, and when you come back in just tell it to reselect.
http://developer.apple.com/iphone/library/documentation/uikit/reference/UIPickerView_Class/Reference/UIPickerView.html#//apple_ref/occ/instm/UIPickerView/selectRow:inComponent:animated: