The following code is saving data and loading, but it doesn’t show the data when loading view controller.It just says label (Xcode default uilabel).
I believe that I have to use synchronize ,but I am not too sure. May someone help me out.
Implementation file:
- (IBAction)minus
{
mini = mini - 1;
minus.text = [NSString stringWithFormat:@"%i", mini];
[[NSUserDefaults standardUserDefaults] setInteger:mini forKey:@"M"];
}
- (void)viewDidLoad
{
mini = [[NSUserDefaults standardUserDefaults] integerForKey:@"M"];
}
Header file:
IBOutlet UILabel *minus;
Change:
Into:
And it should work.
And i dont see you setting minus.text in viewdidload.