SearchBar 设置

2019-07-21  本文已影响0人  wpf_register

基本设置

    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;
上一篇 下一篇

猜你喜欢

热点阅读