我以编程方式使用带有 uitextField 子视图的搜索栏。我得到如下图像:
这里在上面的行中有一个深色。我怎样才能避免得到一条普通的细线?
我使用这个代码:
searchbar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, (self.view.frame.size.height*10)/100, self.view.frame.size.width, (self.view.frame.size.height*13)/100)];
searchbar.delegate=self;
for (searchBarSubview in [searchbar subviews]) {
if ([searchBarSubview conformsToProtocol:@protocol(UITextInputTraits)] ) {
@try {
[[searchbar.subviews objectAtIndex:0] removeFromSuperview];
searchbar.backgroundColor=[UIColor clearColor];
}
@catch (NSException * e) {
// ignore exception
}
}
}