【发布时间】:2020-01-03 10:03:06
【问题描述】:
【问题讨论】:
-
PlaceholderLabel 是标签吗?
-
Placeholder 是 Textfield @jawadAli 中的一个标签
-
使用 placeholderLabel.textColor 而不是 _placeholderLabel.textColor 完成
【问题讨论】:
使用:
placeholderLabel.attributedPlaceholder
【讨论】:
使用 UITextField 扩展
extension UITextField {
func updatePlaceHolder(_ text: String, color: UIColor) {
attributedPlaceholder = NSAttributedString(string: text,
attributes: [NSAttributedString.Key.foregroundColor: color])
}
}
//color set for textfield placeholder
textFieldNumber.updatePlaceHolder("Mobile Number", color: UIColor.init(red: 0, green: 0, blue: 0.0980392, alpha: 0.22))
【讨论】: