开发者

How to Recreate the Last State of an App the Next Time it is Launched?

开发者 https://www.devze.com 2022-12-19 17:51 出处:网络
I have 2 views. When I\'m on the 1st view, I have a textfield. I enter some text in the textfield. I exit 开发者_运维技巧the app, launch some another application and then return to my application. I w

I have 2 views. When I'm on the 1st view, I have a textfield. I enter some text in the textfield. I exit 开发者_运维技巧the app, launch some another application and then return to my application. I want to maintain state of the textfield and that view. Likewise, if I quit with the 2nd view active, when I return to the app I need to return the view to the state it was in when the app quit.

How do I save the information about the state of my app when it last quit so I can recreate it upon the next launch?


Use the NSUserDefaults to write the value and selected view index to the user's preferences.


Apple's DrillDownSave sample may be helpful

0

精彩评论

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

关注公众号