set the value For which page you want to set the session
For example I want to save the session for register.m page
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]
defaults setObject:@"1" forKey:@"Register"];
[defaults synchronize];
in my app i have used main.m as firstpage so in viewDidLoad of same page to get value
- (void)viewDidLoad
{
self.navigationController.navigationBar.hidden=YES;
[super viewDidLoad];
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSString* strValue = [defaults objectForKey:@"Register"];
NSLog(@"NSUserDefaults.....>%@",strValue);
if ([strValue isEqualToString:@"1"])
{
VerificationViewController *rf = [[VerificationViewController alloc] initWithNibName:@"VerificationViewController" bundle:nil];
[self.navigationController pushViewController:rf animated:YES];
}
}
navigate the page in if condition on which you want to navigate the control when next time the application open by the user