Balaji G
Balaji G

Reputation: 673

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..

Upvotes: 0

Views: 1418

Answers (1)

Patrick Goley
Patrick Goley

Reputation: 5417

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.

Upvotes: 2

Related Questions