Reputation: 4732
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)];
Upvotes: 2
Views: 2437
Reputation: 117
I believe you can just do the following:
searchBar.barStyle = UIBarStyleBlackTranslucent;
Kool have fun :)
Upvotes: 1
Reputation: 3921
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;
Upvotes: 6
Reputation: 2384
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!
Upvotes: 0