hi iam going to create an application and my app remember last user action ,, it means user find himself in the same page as he was last time he ran the application .here is my codes but doesn't work ! what is my problem ?
.h
#define HOME_VIEW 0
#define VIEW1 1
#define VIEW2 2
.m
- (void)viewDidLoad {
[super viewDidLoad];
// Set the name of the view
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInt:VIEW1] forKey:@"lastView"];
}
App Delegate :
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Retrieve the last view name
NSInteger constantView = [[NSUserDefaults standardUserDefaults] integerForKey:@"lastView"];
switch(constantView) {
case HOME_VIEW : //load your UIViewController
break;
case VIEW1 : // load your VIEW1
break;
//...
}
}