How to add a TabBar to NavigationController based iPhone app

前端 未结 6 496
花落未央
花落未央 2020-12-24 03:51

I have a simple NavigationController based app. The main window shows a TableView and selecting an item loads a sub-view. I used Interface Builder for UI views.

Now

6条回答
  •  滥情空心
    2020-12-24 04:35

    You can use Interface Builder to edit MainWindow.xib, and add a Tab Bar Controller to your Navigation Controller. You can also change UITabBarController's view controllers to View/Navigation/Table View/Image Picker Controllers with IB's Inspector window. It will work.

    However, I don't really suggest putting Tab Bar Controller into Navigation Controller. The relationship between these controllers will get confused if you go further (make it more complex).

    Assuming you have Table View Controller in your Tab Bar Controller, and want to bring up the detail view. By design, you might want to tell the Navigation Controller to push view into stack, but doing this will make detail view becomes same level with your Tab Bar Controller (both under Navigation Controller) and Table View Controller hold the relation as detail view's parent. This is quite strange, at least to me...

提交回复
热议问题