恢复ViewController状态的最佳方法是什么 [英] What is the best way to restore the state of ViewController

查看:121
本文介绍了恢复ViewController状态的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一些关于如何恢复viewControllers状态的建议。
当您创建一张卡并保存并稍后将其恢复时,就像在名为Pic Collage的应用程序中一样。

I would like to ask some suggestion about how to restore a viewControllers state. Like in the app called "Pic Collage" when you create a card and save it and later restore it.

推荐答案

如果您真的想了解州保护,请参阅WWDC 2012视频,保存和在iOS上恢复应用程序状态

If you really want to learn about state preservation, see WWDC 2012 video, Saving and Restoring Application State on iOS.

但是,有问题的应用程序也可能只是保存模型数据(代表此模型的对象模型)在持久存储中,当应用程序重新启动时,它只是再次加载该模型数据。持久存储有很多可能的技术,范围从核心数据(强大,但有点复杂) plists (简单但不太复杂)。还有很多其他选择(档案和序列化,SQLite,JSON等),但我宁愿不进一步解决这个问题。

But, it's also just as likely that the app in question is simply saving the model data (the object model that represents this card) in persistent storage, and when the app re-starts, it simply loads that model data again. There are a whole bunch of possible technologies for persistent storage ranging from Core Data (robust, but a little complicated) to plists (simple, but less sophisticated). There are tons other options (archives and serialization, SQLite, JSON, etc.), but I'd rather not cloud the issue further.

我建议你熟悉一些这些技术,通过一些演示来完成,如果你有其他问题,请回来。但是这个问题太宽泛,无法在此时得到具体的答案。

I'd suggest you familiarize yourself with some of these technologies, work through a few demonstrations, and come back if you have additional questions. But this question is too broad to get into specific answers at this point.

这篇关于恢复ViewController状态的最佳方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆