【发布时间】:2020-01-01 10:27:22
【问题描述】:
我想更改 TextField 的占位符颜色,但找不到方法。
我尝试设置foregroundColor 和accentColor,但它并没有改变占位符的颜色。
代码如下:
TextField("Placeholder", $text)
.foregroundColor(Color.red)
.accentColor(Color.green)
也许还没有这方面的 API?
【问题讨论】:
-
stackoverflow.com/questions/26076054/… 你需要给它分配
attributedString。 -
NSAttributedString 不确认到 StringProtocol。
-
你设置在
attributedPlaceholder? -
TextField中没有attributedPlaceholder属性。这不是 UITextField。