iosviewcontrolleruikit-state-preservation

What is the best way to restore the state of ViewController


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.


Solution

  • 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.