How to set the color of UISearch Bar
Can anyone advise me on how I can set the color of the UISearchbar such that it follows the color of that search bar used in the address book?
It has a light gray color and the cancel button is of a darker tone.
I tried the code:
//Ser color of UI开发者_开发百科Search bar
sBar.tintColor = [UIColor lightGrayColor];
But is unable to replicate the color and effect (of the button color).
You need to set the tint property of your search bar. e.g.
historySearchBar.tintColor=[UIColor colorWithRed:129.0/255.0f green:129.0/255.0f blue:130.0/255.0f alpha:.80];
This will change the color of your search bar.
Well right now you are using the gray color,which is the color of default search bar Try setting the other color. And you have also the option of setting up the search bar type like black, UIBarStyleBlackTranslucent. Enjoy
精彩评论