简体   繁体   中英

Saving position in view hierarchy in Core Data iPhone app

how would you go about saving a state in a tableview-drilldown, when using core data? So next time you start the app, the drill down level you where at when you exit the app will be loaded in.

I looked at apples drilldownsave sample code, but couldn't figure our how to change to code to work with core data.

Any help would be very appreciated. thanks in advance

Generally you shouldn't do that. Usually (though not always) the model represents some concrete data, where as the position in the drill down is a transient property of a particular user using that data. Most of the time you are better off storing something like that as NSUserDefault, probably as an array of objectIDs for all the NSManagedObjects that should be instantiated and pushed onto the drill down on relaunch.

Sometimes it makes sense to somehow encode that in the model, but in my experience that is not the common case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM