启动时加载最后选择的 UIPickerView
我有一个 UIPickerView 来选择应该显示的 PDF。我想保存最后选择的组件,这样当我退出应用程序或重新启动设备时,它会自动显示最后选择的PDF。我有两个组件,所以我想知道如何完成......谢谢!
I have a UIPickerView to choose the PDF that should be shown. I want to save the last chosen components, so when I quit the app or restart the device, it will automatically show the last chosen PDF. I have two components, so I wanted to know how it can be done...thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
selectedRowInComponent
将选定的行保存在NSUserDefaults
中...然后在呈现
picker
时使用selectRow:inComponent:animated:
EDIT:
像这样保存。
You can save the selected row in
NSUserDefaults
by usingselectedRowInComponent
...And then while presenting the
picker
useselectRow:inComponent:animated:
EDIT:
Save like this.