如何更改 MDCTextField 占位符文本颜色?
How to change MDCTextField placeholder text color?
我目前正在 MDCTextInputControllerOutlined
中使用它。
我已经试过了
self.emailTextField.attributedPlaceholder = NSAttributedString(string: "Email", attributes: [.font: UIFont.ralewayFont(ofSize: 18.0, weight: .semibold), .foregroundColor: UIColor.white])
但不工作
找到了!
将 MDCTextInputControllerOutlined
的 UIColor 设置为 inlinePlaceholderColor
let emailTextField = MDCTextField()
let emailTextFieldController = MDCTextInputControllerOutlined(textInput: emailTextField)
emailTextFieldController.inlinePlaceholderColor = .white
我目前正在 MDCTextInputControllerOutlined
中使用它。
我已经试过了
self.emailTextField.attributedPlaceholder = NSAttributedString(string: "Email", attributes: [.font: UIFont.ralewayFont(ofSize: 18.0, weight: .semibold), .foregroundColor: UIColor.white])
但不工作
找到了!
将 MDCTextInputControllerOutlined
inlinePlaceholderColor
let emailTextField = MDCTextField()
let emailTextFieldController = MDCTextInputControllerOutlined(textInput: emailTextField)
emailTextFieldController.inlinePlaceholderColor = .white