修改UITextField Placeholder的颜色

  • 1 第一种情况只是修改颜色等文字属性

    • 创建属性字典
         NSDictionary *attrsDic = @{ NSForegroundColorAttributeName : [UIColor colorWithRed:106/255.0 green:114/255.0 blue:117/255.0 alpha:1],NSFontAttributeName:[UIFont systemFontOfSize:15] };
    • 创建属性字符串
         NSAttributedString *str = [[NSAttributedString alloc] initWithString:@"anything" attributes:attrsDic];
    • 赋值给textfield的attributedPlaceholder属性
         _txt.attributedPlaceholder = str;
  • 2 第二种情况改颜色和Placeholder位置

    • 继承UITextField

    • 重写drawPlaceholderInRect:方法

    • 设置颜色和位置等

        [colour setFill];
      rect = CGRectMake(0, 0, 0, 0);//修改位置
      [_txtOldPassWord.placeholder drawInRect:rect withFont:_txtOldPassWord.font lineBreakMode:NSLineBreakByTruncatingTail alignment:_txtOldPassWord.textAlignment];

修改UITextField Placeholder的颜色的更多相关文章

  1. Swift 修改UITextField.Placeholder颜色

    StoreNameEditTextField.attributedPlaceholder = NSAttributedString(string:"点此处输入门店名称",attri ...

  2. [HTML] 动态修改input placeholder的颜色

    .invalid:-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: red; } .invalid::-moz-placeholder { ...

  3. 改变UITextField placeHolder 字体 颜色

    [_textSearchField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"]; ...

  4. 修改UITextField placeholder Color

    [YourtextField setValue:[UIColor colorWithRed:97.0/255.0 green:1.0/255.0 blue:17.0/255.0 alpha:1.0] ...

  5. 修改UITextfield的Placeholder字体的颜色

    - (void)viewDidLoad { [super viewDidLoad]; self.title=@"修改UITextField的placeholder字体颜色"; UI ...

  6. [BS-19]更改UITextField的placeholder文字颜色的5种方法

    更改UITextField的placeholder文字颜色的5种方法 想要达到的目标是:一个页面上有多个UITextField,当用户聚焦某textField时,该文本框的placeholder的文字 ...

  7. [转]改变UITextField placeHolder颜色、字体

    本文转载至 http://m.blog.csdn.net/blog/a394318511/8025170 我们有时需要定制化UITextField对象的风格,可以添加许多不同的重写方法,来改变文本字段 ...

  8. (转) 改变UITextField placeHolder颜色、字体 、输入光标位置等

    我们有时需要定制化UITextField对象的风格,可以添加许多不同的重写方法,来改变文本字段的显示行为.这些方法都会返回一个CGRect结构,制定了文本字段每个部件的边界范围,甚至修改placeHo ...

  9. 修改placeholder文字颜色

    .area_ipt ::-webkit-input-placeholder { /* WebKit browsers */ color:#258aca; } .area_ipt :-moz-place ...

随机推荐

  1. Collections.shuffle源码阅读

    java.util.Collections /** * Randomly permutes the specified list using a default source of * randomn ...

  2. 【转】Android:ListView常见错位之CheckBox错位

    原文网址:http://blog.csdn.net/lemon_tree12138/article/details/39337867 ListView在什么样的情况下会出现错位?错位的原因是什么?怎么 ...

  3. Java---设计模块(值对象)

    ★ 场景和问题 在Java开发时,需要来回交换大量的数据,比如要为方法传入参数,也要获取方法的返回值,该如何能更好的进行数据的交互? ★ 基本的编写步骤 ◎第1步:写一个类,实现可序列化(如果以后数据 ...

  4. Generating SSH Keys [Ubuntu Linux]

    Generating SSH Keys We strongly recommend using an SSH connection when interacting with GitHub. SSH ...

  5. Zabbix中文使用手册

    一.Zabbix简介 详情参考“企业监控利器-zabbix”http://waringid.blog.51cto.com/65148/904201. 二.Zabbix使用 2.1 Zabbix框架介绍 ...

  6. JavaWeb:基于MVC设计模式的一个小案例(一)

    (未经允许,请勿转载,谢谢.) 本案例的处理过程: 客户端发送一个请求给服务器,服务器把这个请求给Servlet,Servlet 获取请求信息,根据请求信息的情况去调用 model (在这里是一个普通 ...

  7. [Angular 2] Async Http

    Async Pipe: The Asynce pipe receive a Promise or Observable as  input and subscribes to the input, e ...

  8. Hadoop-2.2.0中文文档—— Common - CLI MiniCluster

    目的 使用 CLI MiniCluster, 用户能够简单地仅仅用一个命令就启动或关闭一个单一节点的Hadoop集群,不须要设置不论什么环境变量或管理配置文件. CLI MiniCluster 同一时 ...

  9. DefaultResouceLoader的设计

    它是什么 DefaultResourceLoader是Spring中的ResourceLoader的默认实现类,也是AbstractApplicationContext的父类,它也可以单独使用,用来从 ...

  10. USB2.0速度识别

    我们知道USB2.0向下兼容USB1.x,即高速2.0的hub能支持所有的速度类型的设备,而USB1.x的hub不能支持高速设备(High Speed Device).因此,如果高速设备挂到USB1. ...