How to change background color of UISearchBar in iOS7?
not gray, I want to change color like my uinavigationbar
if I Use this code, that's what comes out
searchBar.backgroundColor = [UIColor redColor];
That is not red color!!! This exact same situation as in background color of navigation bar.
Change Search Bar Default Image Color The left hand default search image in UISearchBar represents the left view of the UITextField. The Image is rendered to change it to the desired colour. @IBOutlet weak var searchBar: UISearchBar! Hope it will help you in customising the UISearchBar in your app.
At the top select the attributes inspector. Under the section "View" there should be a spot that says "Background". click that and choose your colour.
Need to use:
searchBar.barTintColor = [UIColor redColor];
All thanks!
Set the background image to a clear image and you're good to go. This is also pre-ios 7 compatible.
searchBar.backgroundImage = [[UIImage alloc] init] searchBar.backgroundColor = [UIColor redColor];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With