您的位置:首页 > 其它

textFiled的placeHolder字体颜色

2016-06-27 14:15 155 查看
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];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: