I know how to do this using IB, but how can I do this with just code? OR do I manually have to do the RGB?
I have:
UISearchBar * searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
You need to use the barStyle property and translucent properties together:
UISearchBar * searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
searchBar.barStyle = UIBarStyleBlack;
searchBar.translucent = YES;
I believe you can just do the following:
searchBar.barStyle = UIBarStyleBlackTranslucent;
Kool have fun :)
You should be able to do this via two properties in UISearchBar;
@property(nonatomic, retain) UIColor *tintColor
@property(nonatomic, assign, getter=isTranslucent) BOOL translucent
Set the tintColor
to black, and set translucent
to YES.
Check the reference for more info: http://developer.apple.com/library/iOS/#documentation/UIKit/Reference/UISearchBar_Class/Reference/Reference.html
Hope this does the trick!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.