• <small id='7IbIF'></small><noframes id='7IbIF'>

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

  • <tfoot id='7IbIF'></tfoot>
      <bdo id='7IbIF'></bdo><ul id='7IbIF'></ul>

      <legend id='7IbIF'><style id='7IbIF'><dir id='7IbIF'><q id='7IbIF'></q></dir></style></legend>

      1. 如何在 iOS 中使用导航栏隐藏/显示视图的标签栏?

        时间:2023-05-17

          <tbody id='WaEzf'></tbody>

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

          <legend id='WaEzf'><style id='WaEzf'><dir id='WaEzf'><q id='WaEzf'></q></dir></style></legend>

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

                <tfoot id='WaEzf'></tfoot>
                • <small id='WaEzf'></small><noframes id='WaEzf'>

                  本文介绍了如何在 iOS 中使用导航栏隐藏/显示视图的标签栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个带有导航栏和标签栏的视图.我想要发生的是在某个视图上隐藏标签栏,并在用户更改视图时再次显示标签栏.

                  I have views with a navigation bar and a tab bar. What I would like to happen is to hide the tab bar on a certain view and show the tab bar again when the user changes views.

                  我看到了一段隐藏标签栏的代码:

                  I saw a snippet of code for hiding the tab bar:

                  -(void)makeTabBarHidden:(BOOL)hide
                  {
                      // Custom code to hide TabBar
                      if ( [tabBarController.view.subviews count] < 2 ) {
                          return;
                      }
                  
                      UIView *contentView;
                  
                      if ( [[tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] ) {
                          contentView = [tabBarController.view.subviews objectAtIndex:1];
                      } else {
                          contentView = [tabBarController.view.subviews objectAtIndex:0];
                      }
                  
                      if (hide) {
                          contentView.frame = tabBarController.view.bounds;       
                      }
                      else {
                          contentView.frame = CGRectMake(tabBarController.view.bounds.origin.x,
                               tabBarController.view.bounds.origin.y,
                               tabBarController.view.bounds.size.width,
                               tabBarController.view.bounds.size.height - tabBarController.tabBar.frame.size.height);
                      }
                  
                      tabBarController.tabBar.hidden = hide;
                  }
                  

                  来自:http://nickwaynik.com/iphone/hide-tabbar-in-an-ios-app/

                  我在希望隐藏标签栏的视图上调用它

                  I call this on the view wherein I want the tab bar hidden

                  [self makeTabBarHidden:YES];
                  

                  当我在该视图上显示/隐藏它时它工作正常,但是当我导航回上一个视图时,那里的标签栏也被隐藏了.我尝试在视图的 viewDidUnloadviewWillDisappearviewDidDisappear 函数中调用该函数,但没有任何反应.在前一个视图的viewDidLoadviewWillAppearviewDidAppear函数中调用该函数时也是如此.

                  it works fine when i show/hide it on that view but when I navigate back to the previous view, the tab bar there is also hidden. I tried calling that function in the view's viewDidUnload, viewWillDisappear, viewDidDisappear functions but nothing happens. The same is true when the function is called in the previous view's viewDidLoad, viewWillAppear, viewDidAppear functions.

                  推荐答案

                  你可以设置 UIViewController.hidesBottomBarWhenPushed 来代替:

                  You can set the UIViewController.hidesBottomBarWhenPushed instead:

                  DetailViewController *detailViewController = [[DetailViewController alloc] init];
                  detailViewController.hidesBottomBarWhenPushed = YES;
                  [[self navigationController] pushViewController:detailViewController animated:YES];    
                  [detailViewController release];
                  

                  这篇关于如何在 iOS 中使用导航栏隐藏/显示视图的标签栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何以编程方式为 UINavigationController 子类化 UINavigationBar? 下一篇:Deinit 从未调用过

                  相关文章

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

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

                    <legend id='oph6V'><style id='oph6V'><dir id='oph6V'><q id='oph6V'></q></dir></style></legend>

                    <tfoot id='oph6V'></tfoot>

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