Oxcug
Oxcug

Reputation: 6604

Push UITabBarController onto another UITabBarController

I have a UINavigationController in the root of my UITabBarController. I have another UITabBarController that I am presentint on top of the existing UITabBarController.

However, when I do, the UITabBar from the UITabBarController I'm presenting does not get pushed on top of the existing one from the original UITabBarController. Is there any way to get this functionality?

Upvotes: 1

Views: 1391

Answers (2)

Pradip Vanparia
Pradip Vanparia

Reputation: 1742

First, you need to take reference of root viewController (UINavigationController) Like

   UINavigationController *rootController = self.tabBarController.navigationController;

Or, If you added navigation controller in tabbar. then

   UINavigationController *rootController = self.navigationController.tabBarController.navigationController;

Now, Create object of controller which you want to push.

UITabBarController *tabbarController; 

And push into root controller

[rootController  pushViewController:tabbarController animated:YES];

Upvotes: 5

Bishal Ghimire
Bishal Ghimire

Reputation: 2600

from you question this is what I have assumed.

  1. First VC is TableView Controller which is root VC.
  2. Which needs to push TabBar VC.
  3. Which can further push to tableViewController.

StoryBoard Config enter image description here

Simulator Output enter image description here

Upvotes: 2

Related Questions