基本设置
self.searchBar.barTintColor = [UIColor whiteColor];
self.searchBar.layer.cornerRadius = 5;
self.searchBar.layer.masksToBounds = YES;
self.searchBar.barStyle = UISearchBarStyleMinimal;
背景色设置为白色后,上下各有一条灰色线条
可以如下处理:
UIImageView *barImageView = [[[self.searchBar.subviews firstObject] subviews] firstObject];
barImageView.layer.borderColor = [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0].CGColor;
barImageView.layer.borderWidth=1;
网友评论