0

I created a Search Bar. When i search something, the SearchResultController appears and presents the result. But the status bar is all white ! The problem is that I changed the Status Bar Style to white and that the Status background is also white => EVERYTHING is white now :(

SCREENSHOT OF THE SITUATION HERE : http://omkia.com/screenshot1.png

How do you change the Status Background in this lines please ?

override func viewDidLoad() {
    super.viewDidLoad()
    UIApplication.sharedApplication().statusBarStyle = .LightContent

    self.resultSearchController = ({
        let controller = UISearchController(searchResultsController: nil)
        controller.searchResultsUpdater = self
        controller.dimsBackgroundDuringPresentation = false
        controller.searchBar.sizeToFit()            


        self.tableView.tableHeaderView = controller.searchBar

        return controller
    })()

PS : I am using Xcode 6.3.2 and Swift. Cheers !

Omid
  • 178
  • 3
  • 12

2 Answers2

0

Shouldn't you be changing the navigationbar color? If I'm understanding your problem.

 let navbar = UINavigationBar.appearance()
 navbar.barTintColor = UIColor(red: 22.0/255, green: 33.0/255, blue:      37.0/255, alpha: 1)

Try that and see if something changes.

James Chen
  • 387
  • 1
  • 4
  • 17
  • No thank you but I am not looking for that. I want to change the background color of the status bar when I use the SearchResultsController only. Go and see the image I mentioned in my question if you didn't. It will illustrate my idea ;) – Omid Aug 26 '15 at 18:44
0

You can't change directly to another color than white or black.

I've read that you can put a view behind the navigation bar and status bar, and change its color to the one of your interest.

Carlos.V
  • 409
  • 6
  • 13