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.

有帮助吗?

解决方案

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.

其他提示

Try

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];
UINavigationController *navController = (UINavigationController *)appDelegate.window.rootViewController;
[navController popToRootViewControllerAnimated:YES];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top