• <legend id='xUGqs'><style id='xUGqs'><dir id='xUGqs'><q id='xUGqs'></q></dir></style></legend>

    <tfoot id='xUGqs'></tfoot>
      <i id='xUGqs'><tr id='xUGqs'><dt id='xUGqs'><q id='xUGqs'><span id='xUGqs'><b id='xUGqs'><form id='xUGqs'><ins id='xUGqs'></ins><ul id='xUGqs'></ul><sub id='xUGqs'></sub></form><legend id='xUGqs'></legend><bdo id='xUGqs'><pre id='xUGqs'><center id='xUGqs'></center></pre></bdo></b><th id='xUGqs'></th></span></q></dt></tr></i><div id='xUGqs'><tfoot id='xUGqs'></tfoot><dl id='xUGqs'><fieldset id='xUGqs'></fieldset></dl></div>
      • <bdo id='xUGqs'></bdo><ul id='xUGqs'></ul>

      <small id='xUGqs'></small><noframes id='xUGqs'>

        如何以正确的方式使用导航控制器实现标签栏控制器

        时间:2023-05-16

        <small id='1Y3Bz'></small><noframes id='1Y3Bz'>

            • <i id='1Y3Bz'><tr id='1Y3Bz'><dt id='1Y3Bz'><q id='1Y3Bz'><span id='1Y3Bz'><b id='1Y3Bz'><form id='1Y3Bz'><ins id='1Y3Bz'></ins><ul id='1Y3Bz'></ul><sub id='1Y3Bz'></sub></form><legend id='1Y3Bz'></legend><bdo id='1Y3Bz'><pre id='1Y3Bz'><center id='1Y3Bz'></center></pre></bdo></b><th id='1Y3Bz'></th></span></q></dt></tr></i><div id='1Y3Bz'><tfoot id='1Y3Bz'></tfoot><dl id='1Y3Bz'><fieldset id='1Y3Bz'></fieldset></dl></div>

                <bdo id='1Y3Bz'></bdo><ul id='1Y3Bz'></ul>

                  <tbody id='1Y3Bz'></tbody>
              • <tfoot id='1Y3Bz'></tfoot><legend id='1Y3Bz'><style id='1Y3Bz'><dir id='1Y3Bz'><q id='1Y3Bz'></q></dir></style></legend>
                • 本文介绍了如何以正确的方式使用导航控制器实现标签栏控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我正在使用 Storyboard 和 Xcode 6.我的 Storyboard 中有下一个控制器和场景:

                  I am using Storyboard and Xcode 6. I have next controllers and scenes in my Storyboard:

                  UINavigationControllerHomeViewController 作为根.HomeViewController 有一个 Show (e.g. Push) UITabBarController 的按钮.UITabBarController 有 4 个 UIViewControllers.

                  UINavigationController that has HomeViewController as a root. HomeViewController has a button that Show (e.g. Push) UITabBarController. UITabBarController has 4 UIViewControllers.

                  但我的问题是,在显示 UITabBarController 后,4 个 UIViewControllers 中没有导航栏.但我认为如果我 Show (e.g. Push) UITabBarController 那么它应该有嵌入式导航控制器,它是故事板中的初始控制器.我对吗?如果是这样,我该如何在 Storyboard 中设置导航栏,因为我在 Storyboard 上看到的推送标签栏中现在有默认栏事件.我已选择 UIViewController 并将身份检查器中的模拟指标设置为 Top 属性的半透明导航栏,但我认为它应该自动添加到此控制器和选项卡栏,无需额外步骤.

                  But my problem that after I Show UITabBarController there are no Navigation Bars in 4 UIViewControllers. But I supposed that if I Show (e.g. Push) UITabBarController then it should has embedded navigation controller that is initial controller in storyboard. Am I right? And if so how can I setup then navigation bar in Storyboard, because there are now default bar event in pushed tab bar that I see on storyboard. I have selected UIViewController and set simulated metrics in identity inspector to Translucent Navigation bar for the Top property, but I supposed it should be automatically added to this controller and to the tab bar without additional steps.

                  或者我应该为每个具有根视图控制器的标签栏项目添加新的导航控制器?

                  Or should I add new navigation controller for each tab bar items that will have their root view controllers?

                  主要问题是为什么我在情节提要中使用 show(例如 Push)看不到导航栏.例如,如果我添加导航控制器,然后设置为根 - 选项卡栏控制器,那么 Xcode 会自动添加顶部导航栏,但如果队列有一个额外的步骤,比如我的 HomeViewController,顶部导航栏永远不会自动出现.

                  The main question why I don't see navigation bar in storyboard using show (e.g. Push). For example if I add navigation controller and then set as root - tab bar controller then Xcode automatically add top navigation bar, but if the queue has an extra step like in my case HomeViewController the top navigation bar never appear automatically.

                  推荐答案

                  您好,您需要将标签栏中的每个视图控制器嵌入到它自己的导航控制器中.所以流程是这样的(HomeVC 嵌入在它自己的 NavController 中):

                  Hi you need to embed each view controller that is within the tab bar in a navigation controller of its own. So the flow is like so (HomeVC is embedded in a NavController of it's own):

                                                           / --> `NavController` --> `ViewController1`
                                                           | --> `NavController` --> `ViewController2`
                  `HomeViewController`-->`TabBarController`|--> `NavController` --> `ViewController3`
                                                           --> `NavController` --> `ViewController4`
                  

                  1. 转到编辑器 --> 嵌入 --> 标签栏控制器(或导航控制器)
                  1. Go to Editor --> Embed In --> Tab Bar Controller (or Navigation Controller)

                  回答您的问题:

                  标签栏控制器界面的每个标签都与一个自定义(不同 [原文如此])视图控制器相关联.当用户选择特定选项卡时,选项卡栏控制器会显示相应视图控制器的根视图,替换之前的所有视图.

                  所以选项卡的根视图控制器必须与导航控制器相邻;导航视图控制器必须是下一个内联的,以便视图控制器继承导航.Tab Bar 将视图切换到下一个内联的视图.

                  So the Root View Controller of the tab must be adjoined to a Navigation Controller; a navigation view controller must be next inline in order for the View Controller to inherit a Navigation. A Tab Bar switches views to whatever is next inline.

                  本文档将帮助概述有关它的更多信息.https://developer.apple.com/documentation/uikit/uitabbarcontroller

                  This document will help outline more information about it. https://developer.apple.com/documentation/uikit/uitabbarcontroller

                  这篇关于如何以正确的方式使用导航控制器实现标签栏控制器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:iPhone:如何从左到右做一个presentModalViewController动画 下一篇:如何使用 Swift 从一个视图控制器导航到另一个视图控制器

                  相关文章

                    • <bdo id='aNfrI'></bdo><ul id='aNfrI'></ul>

                    <small id='aNfrI'></small><noframes id='aNfrI'>

                  1. <legend id='aNfrI'><style id='aNfrI'><dir id='aNfrI'><q id='aNfrI'></q></dir></style></legend>
                    <i id='aNfrI'><tr id='aNfrI'><dt id='aNfrI'><q id='aNfrI'><span id='aNfrI'><b id='aNfrI'><form id='aNfrI'><ins id='aNfrI'></ins><ul id='aNfrI'></ul><sub id='aNfrI'></sub></form><legend id='aNfrI'></legend><bdo id='aNfrI'><pre id='aNfrI'><center id='aNfrI'></center></pre></bdo></b><th id='aNfrI'></th></span></q></dt></tr></i><div id='aNfrI'><tfoot id='aNfrI'></tfoot><dl id='aNfrI'><fieldset id='aNfrI'></fieldset></dl></div>

                      <tfoot id='aNfrI'></tfoot>