I'm using a UISearchController and adding its search bar to a table view controller's header:
The issues I'm facing is that when the user starts to type into the search bar, making it the first responder, then the status bar style is reverting to the .Default:
I'm using preferredStatusBarStyle()
to set the style in the view controller. If instead I use the info.plist to set the style and additionally set the 'View Controller Based Status Appearance' key to NO, then the style stays as Light.
However it is not an option to set the 'View Controller Based Status Appearance' key to NO as I have some VCs that require the default style and some that require the light style.
I tried resetting the style to light on a search bar delegate method (which gets invoked when it becomes first responder) i.e.:
func searchBarShouldBeginEditing(searchBar: UISearchBar) -> Bool
{
UIApplication.sharedApplication().statusBarStyle = .LightContent
self.setNeedsStatusBarAppearanceUpdate()
return true
}
But that didn't work either.
Any suggestions?