mlevi mlevi - 1 month ago 19
Objective-C Question

UISearchBar changing status bar color to white

I have a UISearchBar and for some odd reason whenever the search bar is tapped on the status bar color changes from black to white. I don't want the status bar color to change. Any ideas? Thanks.


Answer

The accepted answer here seems to indicate that the UISearchBar sends a call to its "parent" UINavigationController when it begins editing.

Therefore, you seem to have 2 options:

  1. You could simply override the tintColor for the UINavigationController for you UITableViewController, or

  2. You could write a simple UINavigationController subclass that overrides -preferredStatusBarStyle, returning the desired style.

It looks like #1 gives you what you need with minimal fuss/code.