Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 343
mlevi Avatar asked Feb 11 '23 05:02

mlevi


1 Answers

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.

like image 59
mbm29414 Avatar answered Feb 13 '23 21:02

mbm29414