美文网首页
SearchBar 设置

SearchBar 设置

作者: wpf_register | 来源:发表于2019-07-21 17:49 被阅读0次

基本设置

    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;

相关文章

网友评论

      本文标题:SearchBar 设置

      本文链接:https://www.haomeiwen.com/subject/imrvlctx.html