微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

GMSAutocompleteViewController 属性占位符文本颜色

如何解决GMSAutocompleteViewController 属性占位符文本颜色

我正在尝试为 attributedplaceholderUITextField 中的 GooglePlaces 设置 GMSAutocompleteViewController,就像这样......

let placeholderAttributes: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.red,.font: UIFont(name: "Lato-Regular",size: 17) as Any]
let attributedplaceholder = NSAttributedString(string: "Search city or zip code",attributes: placeholderAttributes)
UITextField.appearance(whenContainedInInstancesOf: [UISearchBar.self]).attributedplaceholder = attributedplaceholder

使用 iPhone8 模拟器,这在 iOS12.4 和 iOS14.2 上确实将颜色设置为红色,但在 iOS13.1 上没有。检查显示占位符的 textColor 为 systemGrayColor:

enter image description here

有没有人遇到过类似的情况,我该怎么办(因为这是我需要解决的可访问性问题)......?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。