I am a newbie in this field. I am working on an app in which user can logout from any page inside the app.
I'm using this method for my log out process. (referred from What is the perfect way to make a logout from IOS app?)
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:nil forKey:@"UserId"];
[defaults synchronize];
//redirect to login view
NewClassMoonAppDelegate * appsDelegate =[[UIApplication sharedApplication] delegate];
LoginViewController *second = [[LoginViewController alloc]initWithNibName:nil bundle:nil];
[appsDelegate.window setRootViewController:nil];
[appsDelegate.window setRootViewController:login];
}
}
My question is how to close all the open ViewController before performing logout? When I m implementing above method, page on which I had clicked logout button remains open in background. Can anyone help me regarding the same. Thanks in advance.