Reputation: 39
I want to save the app so when the user, exits, the uitextfields don't erase to text when the user comes back.
When the app is terminated, it erases all the data in the uitextfields.
what do I do?
Upvotes: 0
Views: 79
Reputation: 1466
If you just need the text and not the whole uitextfield object you can put all the fields in a NSDictionary and write them as a plist. There is a a lot of support for this strategy and it may be simplest.
Upvotes: 0
Reputation: 1819
You should save all the values to NSUserDefaults against a key that represents corresponding textFiled. And in appDidFinishLaunching method you should clear all the values. So that when user open the app from terminated state all values gets cleared and display empty textFields.
Upvotes: 1
Reputation: 16002
There are lot of alternatives, using serialization and its read
/write
methods. I think you should have a look at this link : http://cocoaheads.byu.edu/wiki/nscoding.
Upvotes: 1