Browsed the documentation and I couldn't find anything to change the color of UISearchBar. Does anybody know how to change it? There isn't any textColor property :/
Thx
Browsed the documentation and I couldn't find anything to change the color of UISearchBar. Does anybody know how to change it? There isn't any textColor property :/
Thx
You can do the following: Just get the searchField property from the SearchBar, and then change its textColor property.
That's it! Now you manipulate the textField in any way possible.
iOS 8: See https://stackoverflow.com/a/28183058/308315
iOS 6 / 7:
With iOS 11 the search bar is expected to become part of the navigation bar which, as you might expect, adds all kinds of new "features."
I think it's a bug but I found that I needed to do the following to change the text (and cancel button) colour:
I found that the bar-style, when left to "default," would make the text black no matter the tint colour, etc. When set to either Minimal or Prominent the text was visible.
Modified the category suggested by David Foster (@david-foster) to work on iOS 8.
Works on iOS 7 and later:
You may remove unused attribute as well.
UPDATE. Due to
appearanceWhenContainedIn
is deprecated in iOS 9, see the Dishant's answer below: https://stackoverflow.com/a/38893352/2799722Here's a category that adds this functionality: