首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >PlaceholderColor未设置为PlaceHolderLabel for UITextfield in ios13

PlaceholderColor未设置为PlaceHolderLabel for UITextfield in ios13
EN

Stack Overflow用户
提问于 2019-09-25 11:58:47
回答 1查看 341关注 0票数 2

self.setValue(placeHolderColor,forKeyPath:"_placeholderLabel.textColor")

在ios13中,它的crashed.how将placeholderColor设置为placeholderLabel in swift5 for ios13 in xcode11。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-25 12:09:35

使用color设置attributedPlaceholder,如下所示

代码语言:javascript
复制
let colorAttrbs: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.red]
textField.attributedPlaceholder = NSAttributedString(string: "placeholder", attributes: colorAttrbs)
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58097838

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档