我正在寻找一种方法来获得UISearchBar
具有不同背景和文本颜色且没有边框的方法。
我已经这样做了:
[[[self.searchBar subviews] objectAtIndex:0] setAlpha:0.0];
UITextField* searchField = nil;
for(int i = 0; i < self.searchBar.subviews.count; i++) {
if([[self.searchBar.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) { //conform?
searchField = [self.searchBar.subviews objectAtIndex:i];
}
}
if(searchField) {
searchField.backgroundColor = [UIColor colorWithRed:253.0/255.0 green:242.0/255.0 blue:210.0/255.0 alpha:1.0];
searchField.textColor = [UIColor colorWithRed:98.0/255.0 green:65.0/255.0 blue:48.0/255.0 alpha:1.0];
searchField.borderStyle = UITextBorderStyleNone;
}
但我正在寻找一种方法来更改borderStyle
的UISearchBar
文本字段。我还想删除放大镜按钮。这是一种进行这些修改的方法吗?