2011-06-06 36 views
0

我想要一個TabelView導航和永久TabBar在底部。目標C:TabBarController和TableViewController

我推送了TabBarController。它包含控制器列表(ViewController,...和TableViewController) 但是,如果我在TableView中向下導航,TabBar會移動到窗口外部左側(如舊錶格)。

如何在不失去他的情況下使用TabBarController?

回答

1

UITabBarController需要是根視圖控制器。這聽起來像你正在推UITabBarController到UINavigationController的堆棧上。你想要做的是使UINavigationController成爲由標籤欄控制器管理的一個視圖控制器。

1

做到這一點。

  1. 創建標籤欄控制器並將其設置爲您的rootController。

    //You will not have three tabs and you need three view controllers// 
    
  2. 將您的第一個視圖控制器設置爲導航視圖控制器。

    // You will now have the Navigation bar at the top// 
    
  3. 創建一個新的文件,它是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 
    

如果您有任何更多的疑慮;請看這個教程如何去做所有這些。

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

+0

這是[此答案](完全重複http://stackoverflow.com/questions/6255002/uibarbutton-wont-show-up-on-table-view-within-tab-controller/6255948#6255948)。過度的重複會引起其他用戶的標誌,並可能被視爲垃圾郵件。你應該調整你的答案以適應問題,而不是發佈「樣板」答案。謝謝。 – Kev 2011-06-06 21:29:50

+0

對不起。道歉。同樣的問題。我剛剛輸入了那個答案,然後立即遇到了這個問題。再也不會發生。 – Legolas 2011-06-06 21:32:38

相關問題