简体   繁体   English

Push从UITabbarController导航到UIViewController

[英]Push Navigate from UITabbarController to UIViewController

I am using UITabbarController which has three child UIViewController named as FirstViewController , SecondViewController , ThirdViewController . 我正在使用UITabbarController ,它有三个子UIViewController名为FirstViewControllerSecondViewControllerThirdViewController I have a button on FirstViewController . 我在FirstViewController上有一个按钮。 When we tap the button, it need to push navigate to FourthViewController. 当我们点击按钮时,它需要推送到FourthViewController。 Here the FourthViewController navigate inside UITabBarController itself. 这里的FourthViewController在UITabBarController本身内导航。 But i need it navigate out of UITabBarController not inside. 但我需要它导航出UITabBarController不在里面。

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. 只要您的标签栏控制器位于导航控制器中,就会将视图控制器推送到该导航堆栈上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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