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

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

  • <tfoot id='tbTNM'></tfoot>
      <bdo id='tbTNM'></bdo><ul id='tbTNM'></ul>
    <legend id='tbTNM'><style id='tbTNM'><dir id='tbTNM'><q id='tbTNM'></q></dir></style></legend>

        UINavigationController 仅隐藏导航栏 - 后退动画问题

        时间:2023-06-10
          <bdo id='xb1LV'></bdo><ul id='xb1LV'></ul>
            <tfoot id='xb1LV'></tfoot>

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

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

                1. 本文介绍了UINavigationController 仅隐藏导航栏 - 后退动画问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在 UINavigationController 中有三个 viewController.在第二个中,我需要隐藏导航栏而不是后退按钮和其他栏按钮.由于这个原因,我不能使用 isNavigationBarHidden = true
                  目前我正在按以下方式处理上述问题:

                  I have three viewControllers in a UINavigationController. In the second one I need to hide the navigation bar but not the back button and other bar button. For this reason I can't use isNavigationBarHidden = true
                  Currently I am handling the above as follows :

                  第一个视图控制器:

                  override func viewWillAppear(_ animated: Bool) {
                          super.viewWillAppear(animated)
                          self.navigationController?.navigationBar.barTintColor = Constants.kThemeRedColor
                          self.navigationController?.navigationBar.tintColor = UIColor.white
                          self.navigationController?.navigationBar.barStyle = .black
                          self.navigationController?.navigationBar.isTranslucent = false
                      }
                  

                  第二个viewController(只隐藏导航栏):

                  Second viewController (hide only nav bar) :

                  override func viewWillAppear(_ animated: Bool) {
                          super.viewWillAppear(animated)
                          self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
                          self.navigationController?.navigationBar.shadowImage = UIImage()
                          self.navigationController?.navigationBar.isTranslucent = true
                          self.navigationController?.view.backgroundColor = UIColor.clear
                      } 
                  

                  这里的问题是,当我在 firstViewController 之间导航时,在很短的时间内,当第一个 viewController 分别消失和出现时,我会看到一个黑色的导航栏.我知道这是因为用 2nd viewController 编写的代码.但我没有任何其他解决方案可以做到这一点.附上截图:

                  The issue here is that when I navigate from and to the firstViewController, for a very short duration when the 1st viewController is disappearing and appearing respectively, I see a black nav bar on it. I know this is because of the code written in 2nd viewController. But I don't have any other close solution of doing this. Attaching a screenshot :

                  第一个 viewController(应该是怎样的):

                  第二个视图控制器:

                  第一个 viewController(带有短暂的黑色导航栏):

                  推荐答案

                  First viewController中,同样设置backgroundImageshadowImagenavigationBarnil,即

                  In First viewController, also set the backgroundImage and shadowImage of navigationBar as nil, i.e.

                  class FirstVC: UIViewController
                  {
                      override func viewWillAppear(_ animated: Bool)
                      {
                          super.viewWillAppear(animated)
                          self.navigationController?.navigationBar.isTranslucent = true
                          self.navigationController?.navigationBar.setBackgroundImage(nil, for: UIBarMetrics.default)
                          self.navigationController?.navigationBar.shadowImage = nil
                          self.navigationController?.navigationBar.barTintColor = .red
                          self.navigationController?.navigationBar.tintColor = UIColor.white
                          self.navigationController?.navigationBar.barStyle = .black
                      }
                  }
                  
                  class SecondVC: UIViewController
                  {
                      override func viewWillAppear(_ animated: Bool)
                      {
                          super.viewWillAppear(animated)
                  
                          self.navigationController?.navigationBar.isTranslucent = true
                          self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
                          self.navigationController?.view.backgroundColor = UIColor.clear
                          self.navigationController?.navigationBar.shadowImage = UIImage()
                      }
                  }
                  

                  这篇关于UINavigationController 仅隐藏导航栏 - 后退动画问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 PageViewController 导航不起作用 下一篇:使 UIButton 充当导航控制器

                  相关文章

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

                    • <bdo id='ixWqv'></bdo><ul id='ixWqv'></ul>
                    <tfoot id='ixWqv'></tfoot>

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

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