码迷,mamicode.com
首页 > 其他好文 > 详细

textFiled的placeHolder字体颜色

时间:2016-06-27 15:18:49      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

self.title=@"修改UITextField的placeholder字体颜色";

 

    UITextField *textTF=[[UITextField alloc]initWithFrame:CGRectMake(20,130,300,30)];

    textTF.placeholder=@"修改UITextField的placeholder字体颜色";

 

//    // 一种方式

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

 

    // 第二种方式

    textTF.attributedPlaceholder=[[NSAttributedString alloc]initWithString:@"修改UITextField的placeholder字体颜色" attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}];

 

    [self.view addSubview:textTF];

 

textFiled的placeHolder字体颜色

标签:

原文地址:http://www.cnblogs.com/block123/p/5620051.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!