textField设置placehoder字体颜色

方式一:

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

方式二:KVC方式

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

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


你可能感兴趣的:(textField设置placehoder字体颜色)