开发者

Saving the state of a view after action executes

开发者 https://www.devze.com 2023-02-20 14:48 出处:网络
I was wondering how you would save the state of a view after it runs an action that leaves for an开发者_运维问答other view then comes back?

I was wondering how you would save the state of a view after it runs an action that leaves for an开发者_运维问答other view then comes back?

Please Help


Store state variables in NSUserDefaults or use NSArchive / sqlite database. Depends on what kind of state information you wish to store. Always assume your previous view will 'unload' if a new view is loaded (using presentModalView or the UINavigationController). This way you're always prepared for the worst. Under low memory conditions the view currently not visible gets its 'view' unloaded and thus you must recover your previous state yourself (you could even simply use class variables if the first view isn't destroyed).

0

精彩评论

暂无评论...
验证码 换一张
取 消