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

  • <tfoot id='ixaro'></tfoot>

    1. <legend id='ixaro'><style id='ixaro'><dir id='ixaro'><q id='ixaro'></q></dir></style></legend>

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

        如何停止弹出到导航控制器的标签栏的第二次点击?

        How to stop tab bar#39;s second tap which pops to navigation controller?(如何停止弹出到导航控制器的标签栏的第二次点击?)

          <tbody id='Xdrna'></tbody>
        • <small id='Xdrna'></small><noframes id='Xdrna'>

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

                  本文介绍了如何停止弹出到导航控制器的标签栏的第二次点击?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个基于标签栏的应用程序.所有选项卡都有一个导航控制器作为根.如果标签处于活动状态,用户再次点击标签,它会弹回导航控制器.

                  I have a tab bar based app. All tabs have a navigation controller as the root. If the user taps on the tab again if the tab is active, it pops back to the navigation controller.

                  我怎样才能阻止这种行为?

                  How can I stop this behavior?

                  所以实际上我有一个导航控制器 + 一个隐藏的 viewcontroller 可以做出一些决定 + 另一个视图控制器.对于原始问题中的误导性信息,我们深表歉意.我对所有选项卡(其中 3 个)使用隐藏的 viewcontroller,并将 1,2,3 单独的 viewcontrollers 放在每个选项卡上.

                  So in fact I have a navigation controller + a hidden viewcontroller that makes some decisions + another view controller. Sorry for the misleading information in the original question. I use the hidden viewcontroller for all the tabs, 3 of them, since I have the login screen on all 3 if the user is not logged in. If the user logs in, then I pop the login screen, and put the 1,2,3 individual viewcontrollers on each tab.

                  第一次点击:

                   0 : class=Crossing: 0x645c8a0>  
                   1 : class=FavoritesViewController: 0x64ac140>  
                   shouldSelectViewController : UINavigationController  
                   UINavigationController topclass:FavoritesViewController  
                   myTabBarController.selectedViewController :UINavigationController  
                   did disappear  
                   didSelectViewController : UINavigationController  
                   UINavigationController topclass:FavoritesViewController  
                  

                  第二次点击:

                   0 : class=Crossing: 0x645c8a0>  
                   1 : class=FavoritesViewController: 0x64ac140>  
                   shouldSelectViewController : UINavigationController  
                   UINavigationController topclass:FavoritesViewController  
                   myTabBarController.selectedViewController :UINavigationController  
                   didSelectViewController : UINavigationController  
                   UINavigationController topclass:Crossing  
                  

                  推荐答案

                  @MarkGranoff 的做法是正确的,但方法是这样做:

                  @MarkGranoff was on the right track for doing this, but the way to do it is by doing something like this:

                  - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
                  {
                      if ([tabBarController.viewControllers indexOfObject:viewController] == tabBarController.selectedIndex)
                      {
                          return NO;
                      }
                      else
                      {
                          return YES;
                      }
                  }
                  

                  或者用一种不那么冗长的方式:

                  or in a less verbose way:

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

                  如果您只想阻止某个选项卡的默认行为,那么您可以执行以下操作:

                  If you only want to block the default behaviour for a certain tab then you can do something like this:

                  - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController
                  {
                      NSUInteger indexOfNewViewController = [tabBarController.viewControllers indexOfObject:viewController];
                      // Only the second tab shouldn't pop home 
                      return ((indexOfNewViewController != 1) ||
                              (indexOfNewViewController != tabBarController.selectedIndex));
                  }
                  

                  这篇关于如何停止弹出到导航控制器的标签栏的第二次点击?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  UINavigationController inside a UITabBarController inside a UISplitViewController presented modally on iPhone(UISplitViewController 内的 UITabBarController 内的 UINavigationController 以模态方式呈现在 iPhone 上) - IT屋-程序员软件开发技术分
                  ViewController in UINavigationController orientation change(UINavigationController 中的 ViewController 方向更改)
                  Custom back button in UINavigationController(UINavigationController 中的自定义后退按钮)
                  How to get the previous viewcontroller that pushed my current view(如何获取推送我当前视图的上一个视图控制器)
                  The correct way to set a light status bar text color in iOS 7 based on different ViewControllers(iOS 7中基于不同ViewControllers设置灯光状态栏文字颜色的正确方法)
                  Show UITabBar when UIViewController pushed(推送 UIViewController 时显示 UITabBar)

                    <bdo id='xevs4'></bdo><ul id='xevs4'></ul>
                    <tfoot id='xevs4'></tfoot>

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

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

                    1. <legend id='xevs4'><style id='xevs4'><dir id='xevs4'><q id='xevs4'></q></dir></style></legend>
                            <tbody id='xevs4'></tbody>