简体   繁体   中英

Push Navigate from UITabbarController to UIViewController

I am using UITabbarController which has three child UIViewController named as FirstViewController , SecondViewController , ThirdViewController . I have a button on FirstViewController . When we tap the button, it need to push navigate to FourthViewController. Here the FourthViewController navigate inside UITabBarController itself. But i need it navigate out of UITabBarController not inside.

Button Target Action

ForthViewController *share = [[ForthViewController alloc] init];
[self.navigationController pushViewController:share animated:YES];

Could anyone guide me for right way. Thanks in Advance..

Try this:

ForthViewController *share = [[ForthViewController alloc] init];
[self.parentViewController.navigationController pushViewController:share animated:YES];

As long as your tab bar controller is in a navigation controller, this will push your view controller on that navigation stack.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM