是否可以以某种方式保存 UIActionSheet 索引?
我想使用 ActionSheet 对包含许多带有导航控制器的表格视图的应用程序中的选项进行排序。我的问题是,在返回一级或退出应用程序后,我似乎无法在工作表上保留最后选定的索引。索引值默认返回 0,我似乎无法更改其初始值。这可能是一件微不足道的事情,但我真的很感激一些帮助。 谢谢。
I would like to use an ActionSheet for sorting options in an app containing many table views with navigation controllers. My problem is that I cant seem to keep the last selected index on the sheet after poping back one level or quitting the app. The index value defaults back to 0 and I just cant seem to change its initial value. Its possibly something trivial but would really appreciate some help with it.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的意思是您希望后续出现的 UIActionSheet 反映当前设置吗?
如果是这样,那么它可能不是正确使用的 UI 比喻,因为它只是一系列按钮,除了取消操作或具有破坏性之外,没有什么可以将一个按钮与另一个按钮区分开来,而且这两个按钮似乎都不适合您想要跟踪的“排序顺序”设置。
尝试使用一个带有
accessoryType
为UITableViewCellAccessoryCheckmark
的UITableViewCell
的简单UITableView
怎么样?如图1-3所示 此处。Do you mean that you want the
UIActionSheet
on subsequent appearances to reflect the current setting?If so, it may not be the correct UI metaphor to use, since it's just a series of buttons, and there is nothing to distinguish one button from another other than which one cancels an operation or is destructive, and neither of those seem to fit the "sort order" setting you want to keep track of.
What about trying a simple
UITableView
with aUITableViewCell
that has anaccessoryType
ofUITableViewCellAccessoryCheckmark
? Like in Figure 1-3 here.阅读一些有关持久存储的教程或书籍。 Core Data 或 SQLite 可满足数据库需求,或者您可以在
NSUserDefaults
中存储简单值。这应该足以让你上路了。Read some tutorials or books on persistent storage. Core Data or SQLite are available for database needs, or you could store simple values in the
NSUserDefaults
. That should be enough to get you on your way.