How to Recreate the Last State of an App the Next Time it is Launched?
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
精彩评论