darksky
darksky

Reputation: 21019

UITabBarControllers and UINavigationControllers

Problem

I have an app with a UITabBarController and four different tabs. Three of these tabs are tables which you can click on each row and it would take you to another view.

Question

How would I implement that in terms of navigation? Should I create a UITabBarController with Navigation Controllers as tabs (as shown in image 1) or with View Controllers as tabs (as shown in image 2) with each View Controller having its own Navigation Controller property?

Image 1:

Image 1

Image 2:

Image 2

I tried both but its not working well and its confusing. I'd like to know which is more appropriate so I can focus on that method and then see why it's not working.

Upvotes: 0

Views: 252

Answers (1)

lxt
lxt

Reputation: 31304

The first method you propose is the only method. View controllers have a navigationController property, but it will only return something if your view controller is currently contained within a parent navigation controller.

So to be clear: you should have a UITabBarController which contains your navigation controllers, one navigation controller for each tab that you want to have a navigation hierarchy in.

Upvotes: 3

Related Questions