Reputation: 11
How I can save value in TextField for showing after closing and opening app?
self.suma.text = [NSString stringWithFormat:@"%d", [self.a1.text intValue]+[self.a2.text intValue]];
I want to do it with "suma".
Upvotes: 0
Views: 36
Reputation: 7961
See documentation for NSUserDefaults.
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// Write
[defaults setObject:self.suma.text forKey:@"suma"];
// Read
self.suma.text = [defaults stringForKey:@"suma"];
Upvotes: 2