zoukankan      html  css  js  c++  java
  • 46.UISearchBar的placeholder字体颜色和背景颜色

    1.改变searchbar的searchField属性

     UITextField *searchField = [searchbar valueForKey:@"searchField"];

        if (searchField) {

            // 背景色

            [searchField setBackgroundColor:[UIColor colorWithRed:0.074 green:0.649 blue:0.524 alpha:1.000]];

            // 设置字体颜色 & 占位符 (必须)

            searchField.textColor = [UIColor whiteColor];

    //        searchField.placeholder = @"placeholder";

            // 根据@"_placeholderLabel.textColor" 找到placeholder的字体颜色

            [searchField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];

            // 圆角

            searchField.layer.cornerRadius = 10.0f;

            searchField.layer.masksToBounds = YES;

        }

        2.改变searchBarde 图标样式

    [self.searchBar setImage:[UIImage imageNamed:@""] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];

  • 相关阅读:
    js使用笔记
    rabbit-mq使用官方文档
    tomcat Enabling JMX Remote
    Venom的简单使用
    Random模块
    时间模块
    shulti模块简述
    Python的os模块
    Python压缩及解压文件
    Kali的内网穿透
  • 原文地址:https://www.cnblogs.com/qiangzheVSruozhe/p/8631282.html
Copyright © 2011-2022 走看看