【问题标题】:How to change MDCTextField placeholder text color?如何更改 MDCTextField 占位符文本颜色?
【发布时间】:2019-12-09 15:16:33
【问题描述】:

我目前正在与MDCTextInputControllerOutlined 一起使用它。 我已经试过了

self.emailTextField.attributedPlaceholder = NSAttributedString(string: "Email", attributes: [.font: UIFont.ralewayFont(ofSize: 18.0, weight: .semibold), .foregroundColor: UIColor.white])

但不工作

【问题讨论】:

  • 尝试为您的 emailTextField 设置 Tint 颜色
  • 不工作也@manishsharma93

标签: ios material-components material-components-ios


【解决方案1】:

找到了! 将 UIColor 设置为 inlinePlaceholderColorMDCTextInputControllerOutlined

let emailTextField = MDCTextField()

let emailTextFieldController = MDCTextInputControllerOutlined(textInput: emailTextField)
emailTextFieldController.inlinePlaceholderColor = .white

【讨论】:

  • 添加整行代码并接受答案,以便将来对其他人有所帮助。
猜你喜欢
  • 1970-01-01
  • 2017-05-18
  • 2013-02-04
  • 2010-11-23
  • 1970-01-01
  • 1970-01-01
  • 2014-06-10
  • 2013-05-12
相关资源
最近更新 更多