Newbie Questions
Newbie Questions

Reputation: 463

Status Bar disappearing When Searching

I have a problem with my status bar .

it disappears as soon as i press on my search bar,Look at the examples :

Status bar shows normally before search bar pressed: Status bar shows normally before search bar pressed.

Status bar does not show and just disappears out of view: Status bar does not show and just disappears out of view

Thanks ahead ! :)

here is my searchController setup :

 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 = "חפש ברים"

}

Upvotes: 1

Views: 418

Answers (1)

alexburtnik
alexburtnik

Reputation: 7741

Try this setting:

searchController.hidesNavigationBarDuringPresentation = false

And override this function (Swift 2):

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

Upvotes: 3

Related Questions