Quote:
Originally Posted by ncotter
Hello everyone
I really need some help in saving data for my app i really don't care how it is saved but just saved i have searched forever and cant find anything that works if you can help wih either please make a project and upload it to mediafire or somthing simillar and in the project with lots of //comments to explain//
I am sorry for comming across needy i am aproching a deadline
thank you so much for helping in advance
|
You want to save the contents of a text field so it's still there when you relaunch your app?
Use code like this:
Code:
NSString* fieldText = myTextField.text;
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject: fieldText forKey: @"fieldTextKey"];
Then, in your view controller's viewDidLoad method, read back the value:
Code:
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* fieldText = [defaults stringForKey: @"fieldTextKey"];
myTextField.text = fieldText;
You would need to replace "myTextField" with the name of your text field.
No, I'm not going to create a full project for you that does this. Unless, of course, you'd like to hire my company to do this for you...