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

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

          <bdo id='Zbgp9'></bdo><ul id='Zbgp9'></ul>

      2. Swift 调用 setNavigationBarHidden 但视图不会移到顶部

        时间:2023-06-10
      3. <legend id='WAy7U'><style id='WAy7U'><dir id='WAy7U'><q id='WAy7U'></q></dir></style></legend>

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

              • <bdo id='WAy7U'></bdo><ul id='WAy7U'></ul>
              • <small id='WAy7U'></small><noframes id='WAy7U'>

                  本文介绍了Swift 调用 setNavigationBarHidden 但视图不会移到顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  当我通过调用滚动时隐藏我的导航栏:self.navigationController?.setNavigationBarHidden(true, animated: true)

                  I am hiding my navigation bar when I scroll by calling: self.navigationController?.setNavigationBarHidden(true, animated: true)

                  唯一的问题是导航栏没有完全隐藏.

                  The only problem is that the navbar doesnt get hidden all the way.

                  更奇怪的是,如果我推到一个新的 VC 并返回,现在尝试滚动导航栏会一直隐藏,这正是我想要的.

                  Whats even stranger is if I push to a new VC and go back and now try to scroll the navigation bar gets hidden all the way which is what I want.

                  如果重要的话,我会在 VC2 上隐藏导航栏,然后在我退出到 VC 1 时显示它.

                  If it matters I am hiding the navigation bar on VC2 then showing it when I exit back to VC 1.

                  这是我第一次尝试隐藏导航栏时的样子,它不会一直向上/底层视图显示太多.

                  This is what it looks when I try to hide the navbar first time, it doesnt go up all the way/underlying view showing too much.

                  如果我推到下一个 VC 并返回并现在尝试隐藏导航栏,它可以工作

                  If I push the to next VC and go back and now try to hide the navigationbar it works

                  我的视图对顶部布局有 0 的约束,因此它拥抱顶部

                  The my view has a constraint of 0 to top layout so its hugging the top

                  那么在隐藏导航栏时,如何让我的视图始终像第二张图片一样?

                  So how can I make my view always be like in the second image when hiding my navigation bar?

                  推荐答案

                  试试这个代码...

                  注意:这是解决您的问题的简单方法.如果您想要更多自定义外观导航栏和状态栏外观.您应该阅读我之前的评论...

                  Note: This is a simple approach for your problem. If you want more custom look navBar and status bar look .You should read my previous comment...

                  将导航控制器属性 hidesBarsOnSwipe 设置为 true

                  Set navigation controller property hidesBarsOnSwipe to true

                       override func viewDidAppear(animated: Bool) {
                  super.viewDidAppear(animated)
                  
                  navigationController?.hidesBarsOnSwipe = true
                  

                  }

                  这篇关于Swift 调用 setNavigationBarHidden 但视图不会移到顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:iOS应用启动黑屏、UINavigationController、Nib、RootViewController 下一篇:在 PageViewController 导航不起作用

                  相关文章

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

                  <legend id='0rg1c'><style id='0rg1c'><dir id='0rg1c'><q id='0rg1c'></q></dir></style></legend>

                  1. <small id='0rg1c'></small><noframes id='0rg1c'>

                      <bdo id='0rg1c'></bdo><ul id='0rg1c'></ul>

                  2. <tfoot id='0rg1c'></tfoot>