2017-09-30 109 views
0

我知道SearchDisplayController已被棄用,但Storyboard仍然支持它,並且它是一種在視圖控制器上呈現tableViewController的簡單方法。我一直在使用它,而且我仍然更願意使用它。在iOS 11中,當我運行我的應用時,SearchDisplayController的狀態欄。在搜索欄關注之後,點擊BLACK。有誰知道如何解決這個錯誤?此外,如果你意識到,搜索者的利潤率是關閉的。我正在使用默認的iOS 11搜索欄。下面附截圖:iOS 11 SearchDisplayController顯示黑色狀態欄

look at the empty black status bar space

回答

0

這不是最好的解決辦法實際上,但是它的工作原理來改變狀態欄的顏色。

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

請記住,這將影響整個應用程序。如果您只需要更改某些視圖,請保存以前的顏色以將其恢復。

問候。

0

您是否嘗試將extendedLayoutIncludesOpaqueBars屬性設置爲true?

searchDisplayController.extendedLayoutIncludesOpaqueBars = true