سؤال

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