iOS 11 SearchDisplayController显示黑色状态栏

时间:2017-09-30 20:51:25

标签: ios ios11 searchdisplaycontroller

我知道不推荐使用SearchDisplayController,但Storyboard仍然支持它,并且它是一种在视图控制器上呈现tableViewController的简单方法。我一直在使用它,我仍然宁愿使用它。在iOS 11中,当我运行我的应用程序时,SearchDisplayController的状态栏。搜索栏聚焦后,是黑色。有谁知道如何解决这个bug?此外,如果你意识到,搜索者的边缘是关闭的。我使用默认的iOS 11搜索栏。下面是截图:

look at the empty black status bar space

2 个答案:

答案 0 :(得分:0)

这实际上不是最佳解决方案,但它可以更改状态栏颜色。

if let statusBar = UIApplication.shared.value(forKeyPath: "statusBarWindow.statusBar") as? UIView {
    statusBar.backgroundColor = //YOUR COLOR HERE
  }

请记住,这会影响整个应用。如果您只需要更改某些视图,请保存以前的颜色以恢复它。

问候。

答案 1 :(得分:0)

您是否尝试将extendedLayoutIncludesOpaqueBars属性设置为true?

searchDisplayController.extendedLayoutIncludesOpaqueBars = true