PDA

View Full Version : How to start my application from last exit point, if any.




oceandrive
Nov 17, 2008, 04:00 PM
New to icoding. Can someone please guide me how to start my application from where I had exited earlier.

CaseStudy:

1) I opened my sample application
2) Entered some comments into the textarea.
3) Exit the application

4) Not if I open my applicaiton I want to see the data which I entered previously.

Thanks for help.



dejo
Nov 17, 2008, 04:18 PM
You'll want to save your data (using NSUserDefaults is pretty easy) in the applicationWillTerminate: method of your application delegate and then restore it in the applicationDidFinishLaunching: method of the same.

fenrus110
Nov 17, 2008, 05:15 PM
check out the DrillDownSave sample.

Though, the TextView might be a bit trickier. I'd recommending looking for any events that execute just before the app closes and then save into NSUserDefaults or sqlite

oceandrive
Nov 19, 2008, 08:26 AM
Thanks for the excellent help. I followed the example and it worked like what I wanted. Keep up the good work.