将单个导航控制器与标签栏控制器

时间:2016-05-23 22:16:30

标签: ios

我想将导航控制器和标签栏控制器组合在一起,并通过标签栏显示3个视图控制器。

如果我将三个vcs中的每一个嵌入到自己的导航控制器中,然后将它们添加到标签栏控制器,我就可以完成此操作。 但是现在有三个导航控制器。

但根据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个用于视图控制器,1个用于导航控制器。

如果苹果文档说可能有一个单独的导航控制器,那么苹果公司的说明有什么问题呢?如何在标签栏中输入三个项目?

1 个答案:

答案 0 :(得分:0)

Apple文档只是说您可以使用中的导航控制器单个选项卡来控制该选项卡中的导航。如果您有多个选项卡并且想要所有选项卡中的导航控制器,那么您可以这样做,但三个导航控制器将是独立的。

换句话说,您可以在应用中同时使用标签栏和导航控制器,但不能用于相同的目的。标签栏提供顶级导航,导航控制器提供向下导航。您无法同时使用标签栏和导航控制器来控制顶级导航。

以下是Apple Human Interface Guidelines regarding navigation

相关问题