簡體   English   中英

將單個導航控制器與標簽欄控制器結合

[英]Combining single navigation controller with tab bar controller

我想將導航控制器和標簽欄控制器組合在一起,並通過標簽欄顯示3個視圖控制器。

如果將三個vc分別嵌入到其自己的導航控制器中,然后將它們添加到選項卡欄控制器中,則可以實現此目的。 但是,現在有三個導航控制器。

但是根據Apple文檔,可以使用單個導航控制器: https : //developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/Chapters/CombiningViewControllers.html

To create a combined interface with three tabs that contain custom view controllers and one tab that contains a navigation controller:

1) Create three custom view controllers, one for each tab, and a navigation controller.
2) Select the three custom view controllers and the navigation controller (only the navigation controller scene, not it’s root view controller).
3) Choose Editor > Embed In > Tab Bar Controller.
4) Display the tab bar controller as the first view controller by selecting the option Is Initial View Controller in the Attributes inspector (or present the view controller in your user interface in another way.)

該引用中的第一句話提到“導航控制器”,即單數。 並且在說明中說“導航控制器”,也為單數。

但是,當我按照這些說明進行操作時,我最終得到一個標簽欄,其中包含4個項目,其中3個用於視圖控制器,一個用於導航控制器。

如果有可能像Apple文檔所述那樣只有一個導航控制器,那么Apple的說明有何問題? 如何在標簽欄中獲得三個項目?

Apple文檔只是說您可以單個選項卡中使用導航控制器來控制該選項卡中的導航。 如果您有多個選項卡,並且所有選項卡都需要導航控制器,那么可以的話,您可以這樣做,但是三個導航控制器將是獨立的。

換句話說,您可以在應用程序中同時使用標簽欄和導航控制器,但不能同時使用。 標簽欄提供頂層導航,導航控制器提供下層導航。 您不能同時使用標簽欄和導航控制器來控制頂級導航。

這是有關導航的Apple 人機界面指南

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM