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

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

      1. <legend id='wIfYD'><style id='wIfYD'><dir id='wIfYD'><q id='wIfYD'></q></dir></style></legend>
          <bdo id='wIfYD'></bdo><ul id='wIfYD'></ul>

        防止双击 UITabBarController 时自动 popToRootViewController

        时间:2023-05-17
            <bdo id='Kh0LY'></bdo><ul id='Kh0LY'></ul>
                <tbody id='Kh0LY'></tbody>
              <i id='Kh0LY'><tr id='Kh0LY'><dt id='Kh0LY'><q id='Kh0LY'><span id='Kh0LY'><b id='Kh0LY'><form id='Kh0LY'><ins id='Kh0LY'></ins><ul id='Kh0LY'></ul><sub id='Kh0LY'></sub></form><legend id='Kh0LY'></legend><bdo id='Kh0LY'><pre id='Kh0LY'><center id='Kh0LY'></center></pre></bdo></b><th id='Kh0LY'></th></span></q></dt></tr></i><div id='Kh0LY'><tfoot id='Kh0LY'></tfoot><dl id='Kh0LY'><fieldset id='Kh0LY'></fieldset></dl></div>

                1. <tfoot id='Kh0LY'></tfoot>

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

                2. <legend id='Kh0LY'><style id='Kh0LY'><dir id='Kh0LY'><q id='Kh0LY'></q></dir></style></legend>
                  本文介绍了防止双击 UITabBarController 时自动 popToRootViewController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  UITabBarController 的默认行为是在第二次点击特定选项卡时将包含的 UINavigationController 弹出到根视图控制器.我有一个特殊的用例,我希望它不能自动工作,我很难弄清楚如何防止这种情况.

                  The default behavior of a UITabBarController is to pop the contained UINavigationController to the root view controller when a particular tab is tapped a second time. I have a particular use case where I'm wanting this to not work automatically, and I'm having a hard time figuring out how to prevent this.

                  有没有人遇到过这种情况,如果有,你做了什么?我需要继承 UINavigationController 并覆盖 popToRootViewController 还是有更简单的方法?

                  Has anyone run into this, and if so, what did you do? Do I need to subclass UINavigationController and override popToRootViewController or is there a simpler way?

                  推荐答案

                  使用tabBarController:shouldSelectViewController: 方法/ios/#documentation/uikit/reference/UITabBarControllerDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UITabBarControllerDelegate/" rel="noreferrer">UITabBarControllerDelegate 协议.

                  Use the tabBarController:shouldSelectViewController: method of the UITabBarControllerDelegate protocol.

                  - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
                      return viewController != tabBarController.selectedViewController;
                  }
                  

                  不要忘记将标签栏控制器的委托设置为实际实现此委托方法的对象.

                  Don't forget to set the delegate of the tab bar controller to the object that actually implements this delegate method.

                  这篇关于防止双击 UITabBarController 时自动 popToRootViewController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:关闭外部水龙头上的模态视图表单控制器 下一篇:为什么我在使用 UINavigationController 时不能强制横向?

                  相关文章

                    <bdo id='LoayM'></bdo><ul id='LoayM'></ul>
                3. <legend id='LoayM'><style id='LoayM'><dir id='LoayM'><q id='LoayM'></q></dir></style></legend>
                  <tfoot id='LoayM'></tfoot>

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

                    1. <small id='LoayM'></small><noframes id='LoayM'>