user3092794
user3092794

Reputation: 11

iphone xcode 5 app iOS

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

Answers (1)

NathanAldenSr
NathanAldenSr

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

Related Questions