My setup is follows: I have a TabBarController at the root initial view and the following tabs: TabViewController1 and MoreMenuViewController. The More Menu View controller has an embedded UIVNavigationController which has a button that pushes SettingsViewController into view.
UITabbarController -> UINavigationController -> TabViewController1
UITabbarController -> UINavigationController -> MoreMenuViewController -> SettingsViewController
Now, assume I am in the SettingsViewController. I click the tab to go to TabViewController1. When I click the tab to go to MoreMenuViewController I am shown SettingsViewController instead. I'd like it to show MoreMenuViewController on tab switch.
I am using iOS8 and XCode6 with Storyboards.
In your MoreMenuViewController
you can implement UITabBarControllerDelegate
method like this:
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
[self.navigationController popViewControllerAnimated:NO];
}
Moreover you need to set MoreMenuViewController
to be delegate of UITabBarControllerDelegate
(for example in viewDidLoad
method) via:
self.tabBarController.delegate = self;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.