Objective C: TabBarController and TableViewController

北城余情 提交于 2020-01-07 04:47:08

问题


i want a TabelView-Navigation and permanently a TabBar at the bottom .

I pushed the TabBarController. It contains a list of Controllers (ViewController, ... and the TableViewController) But if i navigate down in the TableView the TabBar moves to the left outside the window (like the old Table).

How can i use the TabBarController without losing him?


回答1:


The UITabBarController needs to be the root view controller. It sounds like you are pushing a UITabBarController onto the stack of a UINavigationController. What you want to do is make the UINavigationController one of the view controllers managed by the tab bar controller.




回答2:


Do this.

  1. Create the Tab Bar Controller and set it as your rootController.

    //You will not have three tabs and you need three view controllers//
    
  2. Set your First View controller as a Navigation View controller.

    // You will now have the Navigation bar at the top//
    
  3. Create a new file which is a subclass of the UITableViewController.

    // set this as your delegate and datasource for your table view controller methods//
    // pull a table view controller inside the Navigation View Controller as mentioned in (2) & you will have a tableview and navigation view in FirstViewController. Similarly work with the other two tabs
    

If you have any more doubts; please watch this tutorial on how to do all of these.

http://www.youtube.com/watch?v=LBnPfAtswgw



来源:https://stackoverflow.com/questions/6253743/objective-c-tabbarcontroller-and-tableviewcontroller

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