How to change background color of UISearchBar in iOS7

dev.nikolaz picture dev.nikolaz · Oct 10, 2013 · Viewed 57.2k times · Source

How to change background color of UISearchBar in iOS7?

enter image description here

not gray, I want to change color like my uinavigationbar

if I Use this code, that's what comes out

searchBar.backgroundColor = [UIColor redColor];

enter image description here

That is not red color!!! This exact same situation as in background color of navigation bar.

Answer

dev.nikolaz picture dev.nikolaz · Oct 10, 2013

Need to use:

searchBar.barTintColor = [UIColor redColor];

enter image description here

All thanks!