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];

  • 相关阅读:
    windows下配置docker
    libxml2 安装及使用
    lua 5.3 英文手册 自己收集整理版
    Unity3D RPC调用顺序问题
    对于问题的一个思考
    第十三章博客
    第十一章
    第十章博客
    第九章笔记
    S1304数据库前三章测试错题
  • 原文地址:https://www.cnblogs.com/qiangzheVSruozhe/p/8631282.html
Copyright © 2011-2022 走看看