搜索时状态栏消失

Status Bar disappearing When Searching

我的状态栏有问题。

我一按我的搜索栏它就消失了,看例子:

在按下搜索栏之前状态栏正常显示:

状态栏不显示,只是消失在视线之外:

提前致谢! :)

这是我的 searchController 设置:

 override func viewDidLoad() {
        super.viewDidLoad()

definesPresentationContext = true
self.resultsController.tableView.dataSource = self
self.resultsController.tableView.delegate = self
self.searchController.hidesNavigationBarDuringPresentation = false
self.searchController = UISearchController(searchResultsController: self.resultsController)
self.tableView.tableHeaderView = self.searchController.searchBar
self.searchController.searchResultsUpdater = self
self.searchController.dimsBackgroundDuringPresentation = true
self.searchController.searchBar.sizeToFit()
self.searchController.searchBar.barTintColor = UIColor.blackColor()
self.searchController.searchBar.endEditing(true)
self.searchController.searchBar.placeholder = "חפש ברים"

}

试试这个设置:

searchController.hidesNavigationBarDuringPresentation = false

并覆盖此函数 (Swift 2):

override func preferredStatusBarStyle() -> UIStatusBarStyle { 
    return .LightContent 
}