What is the best way to restore the state of ViewController

别来无恙 提交于 2019-12-01 11:41:48

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

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.

If you are supporting iOS 6 and above, take a look at State Preservation and Restoration. Even if you have to support older versions of iOS the documentation will guide you on when and how restoration can be achieved and the things you need to consider.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!