Reputation: 21
self.setValue(placeHolderColor, forKeyPath: "_placeholderLabel.textColor")
in ios13 its crashed.how to set placeholderColor to placeholderLabel in swift5 for ios13 in xcode11.
Upvotes: 2
Views: 354
Reputation: 15258
Set color
using attributedPlaceholder
as below,
let colorAttrbs: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.red]
textField.attributedPlaceholder = NSAttributedString(string: "placeholder", attributes: colorAttrbs)
Upvotes: 3