首页 新闻 会员 周边 捐助

iphone UISearchBar 如何去掉白色区域或者改变为黑色

0
悬赏园豆:15 [待解决问题]

不管怎么操作就是 没有办法改变里面的白色区域

 

UISearchBar *searchBar = [[UISearchBaralloc] initWithFrame: CGRectMake(15.0f, 30.0f, 145.0f, 45.0f)];  

    searchBar.placeholder = @"Enter Name";

    searchBar.delegate = self;

    searchBar.showsCancelButton = NO;

searchBar.showsScopeBar = NO;

searchBar.barStyle = UIBarStyleBlackTranslucent;

searchBar.inputView.backgroundColor = [UIColorclearColor];

 

 

searchBar.alpha = 1.0f;

 

searchBar.backgroundColor = [UIColorclearColor];

 

 

 

for (UIView *subview in searchBar.subviews

{

if ([subview isKindOfClass:NSClassFromString(@"UISearchBarBackground")])

{

[subview removeFromSuperview];  

break;

}

[[[searchBar subviews] lastObject] setBackgroundColor:[UIColorcolorWithRed:0.118fgreen:0.118fblue:0.118falpha:1.0f]];

searchBar.keyboardType = UIKeyboardTypeDefault;

[self addSubview:searchBar];

self._searchBar = searchBar;

[searchBar release];

yanxun的主页 yanxun | 初学一级 | 园豆:185
提问于:2011-09-26 18:01
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册