Reputation: 327
I have login screen (viewcontroller) and then another signature screen (viewcontroller). Then tabbar controller is presented above signature screen. when the user tap logout button in tabbar controller stack the app should navigate to login screen. I have tried dismissing tabbar controller, but it is not navigating to login screen instead it is navigating to signature screen.
Below is the navigation structure
UINavigationController -- ViewController1 (Login Screen) | --- ViewController2 (Signature Screen) | --- TabbarController (Five Tab Items)
How can i navigate to login screen. Any help is appreciated.
Upvotes: 2
Views: 2584
Reputation: 119031
When the signature view controller presents the tab controller, do this:
[self presentViewController:tabController
animated:YES
completion:^{
[self.navigationController popViewControllerAnimated:NO];
}];
Then, when the tab controller is dismissed the login view will already be there waiting.
Upvotes: 2
Reputation: 10201
Try
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
UINavigationController *navController = (UINavigationController *)appDelegate.window.rootViewController;
[navController popToRootViewControllerAnimated:YES];
Upvotes: 2