`
zjjzmw1
  • 浏览: 1352513 次
  • 性别: Icon_minigender_1
  • 来自: 开封
社区版块
存档分类
最新评论

更改UITextField 的 placeholder的颜色

    博客分类:
  • iOS
阅读更多

方式一:

_codeTextField.attributedPlaceholder = [[NSAttributedString allocinitWithString:@"请输入验证码(4位数字)" attributes:@{NSForegroundColorAttributeName:[UIColor colorWithHex:kTextLightGray]}];

方式二:KVC方式

_phoneTextField.placeholder = @"请输入手机号码";

 [_phoneTextField setValue:[UIColor colorWithHex:kTextLightGrayforKeyPath:@"_placeholderLabel.textColor"];

 

 

 

_phoneTextField.placeholder = @"请输入手机号码";

 这句需要放在 设置颜色 的前面。。。。。。。。。。否则不起作用。!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics