Im saving data and reloading using the follwing code.
- (IBAction)savefirstline:(id)sender {
NSString *savecontents = firstlineofadsress.text;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:savecontents forKey:@"savecontents2"];
[defaults synchronize];
- (IBAction)loadfirstline:(id)sender {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *loadstring = [defaults objectForKey:@"savecontents2"];
[firstlineofadsress setText:loadstring];
My question is how do i add more text fields to this method. Presently I have to set up each text box with two buttons to enable save and load of the string and im sure this cant be right as i have about 5 text fields. Ive tried adding other textfields.text to the NSSstring but just keep getting errors
You could give each of your textfields a unqie tag number, and then create a switch that deals with each textfield.
so something like: