Felipe Boszczowski Felipe Boszczowski - 2 months ago 7
Objective-C Question

How to TabBarController display differents Items?

On my

firstViewController
I have a
tabbar
that contains my
firstViewController
and a
helpViewController
.

When I click on a button from the
FirstViewController
, I push a
NewViewController
. But, when this view is pushed, I want to change the content from the
TabBarController
to display other ViewControllers, like
infoViewController
,
optionViewController
and
NewViewController
. Is that possible?

The First Image represents my application. The
FirstViewController
has a button that will push the
NewViewController
. When the user clicks this button, I want that my app shows what is in the second image. Is possible?My problem

Answer

!!This app uses navigationController and TabBarController!! Using the storyboard I saw each piece of the app, then I had the Idea: Insted of pushing the NewViewController, how about push a tabBarController? When the user clicks the button, the app will push the tabBarController with 2 TabController`s.

Just add New File to your project, sub classed UITabBarController. Then add this code to the init method of your tabBarController: self.hidesBottonBarWhenPushed = YES;

On ViewDidLoad just alloc and init what views you want to display on the tabBar and

self setViewControllers:[NSArray arrayWithObjects: vc1, vc2, vc3, nil]];

Working fine here :D