不管怎么操作就是 没有办法改变里面的白色区域
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];