UITabBarControllers and UINavigationControllers

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-07 04:58:21

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/6563421/uitabbarcontrollers-and-uinavigationcontrollers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!