Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

Try

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
UINavigationController *navController = (UINavigationController *)appDelegate.window.rootViewController;
[navController popToRootViewControllerAnimated:YES];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top