小编eme*_*rog的帖子

swift 4 中的 UITextField 属性占位符颜色和不透明度

我有自定义的textField具有@IBInspectable财产placeHolderColor: UIColor和正常工作。我通过以下方式设置:

attributedPlaceholder = NSAttributedString(string: placeHolder, attributes:[NSAttributedStringKey.foregroundColor: placeHolderColor])
Run Code Online (Sandbox Code Playgroud)

如何以编程方式仅为此属性设置不透明度值,而不是为文本字段中的普通文本设置不透明度值?我没有找到任何匹配NSAttributedStringKey来执行此操作

uitextfield ios swift nsattributedstringkey

3
推荐指数
1
解决办法
3714
查看次数

标签 统计

ios ×1

nsattributedstringkey ×1

swift ×1

uitextfield ×1