UISearchBar: barTintColor property
The barTintColor property is the search bar's own background color.
Value
A color string, or null.
- Readable and writable.
- The default is
null, meaning the system background. - Writing
nullrestores the system background. - There is no change event: only the app's own code changes it.
Invalid values
Writing an invalid color doesn't throw. The console prints a warning, and the value stays unchanged; see colors.
Examples
js
const search = new UISearchBar();
search.barTintColor = '#F2F2F7';Effect: The search bar's background turns light gray. Not verified in the simulator.
Corresponding iOS API
UISearchBar.barTintColor.