Xcode:隐藏导航栏时摆脱黑条 [英] Xcode: Getting rid of black bar when hiding navigation bar

查看:305
本文介绍了Xcode:隐藏导航栏时摆脱黑条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

情景

我有一个应用程序,允许用户向上滚动UITableView以查看帖子。当它们向上滚动时,导航栏将隐藏。我使用以下SO帖子中的代码...

I have an app that allows users to scroll up on a UITableView to view posts. When they scroll up the navigation bar will hide. I use the code from the following SO post...

模仿iOS 7 Facebook隐藏/显示扩展/收缩导航栏

问题

当我在那里尝试第一个答案时,我第一次使用它就完美了。在我把它带到它正在工作的地方后,我试图让我的Tab Bar下降。当我烦躁地使用我的代码时,我一定要搞砸了。因为现在当我运行相同的代码时,我得到的这个黑条不会消失。

When I tried the first answer on there it worked the first time I used it, perfectly. After I got it to where it was working I tried to get my Tab Bar to drop down as well. When I fidgeted around with my code I must have fudged something up. Because now when I run the same code, I get this black bar that won't go away.

未滚动(正常)

向上滚动(留下难看的黑条)

我还尝试了什么

GTScrollNavigationBar
和TLYShyNavBar

GTScrollNavigationBar and TLYShyNavBar

他们都离开了黑条......

and they both leave the black bar also...

问题

有谁知道如何解决这个问题?

Does anyone know how to fix this?

推荐答案

我认为您的问题与导航栏不透明有关。在您的视图控制器中,确保选中属性在不透明栏下并且它应该没问题。

I think your issue here has to do with your navigation bar not being transparent. In your view controller, make sure the property Under Opaque Bars is checked and it should be fine.

另一种方法是设置视图控制器上的> extendedLayoutIncludesOpaqueBars YES (不是默认值)。

Another way to doing that is to set extendedLayoutIncludesOpaqueBars to YES (not the default) on your view controller.

这篇关于Xcode:隐藏导航栏时摆脱黑条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆