Murat
Murat

Reputation: 908

How to : Navigation Controller in Tab Bar Controller

I'm woking on a simple iphone application. The applicaton has a table view on first screen. If the user clicks on an item on that table view, application navigates to the second view. The second view has a table view, too. If the user clicks on an item on this screen, I want to show a new xib which has Tab Bar Controller.

Actually, I did it. But, the problem is that I can't see the tabs. The tabs are shown at the bottom, outside of the screen. How can I solve this problem?

Thanks.

Upvotes: 12

Views: 29622

Answers (3)

ChangUZ
ChangUZ

Reputation: 5448

Open Interface Builder.

Click a tab and check whether sub-controller(of tabbar controller) is UIViewController or UINavigationController. (Default: UIViewController)

If UIViewController, replace it with UINavagationController.

And Set the root view controller of UINavigationController to first view controller.

Last, call pushViewController method, not presentModalViewController method.

Upvotes: 1

bentford
bentford

Reputation: 33416

Here is an tutorial that I was able to get working.

I also read the official SDK documentation on the topic: Combining Tab Bar and Navigation Controllers. Since I'm still learning, the tutorial helped me more than the docs.

NOTE: in the tutorial, i don't think you need to subclass UINavigationController, and I'm experimenting with this idea now.

UPDATE: I was able to get the tutorial working without subclassing UINavigationController. So a subclass is not required.

Upvotes: 14

Wytchkraft
Wytchkraft

Reputation: 77

TabBar HAS to be the root controller, add navControllers in the tab items as needed and hide the tabBar at the beginning of the App, to show it when you want it to appear.

Upvotes: -1

Related Questions