Reputation: 43
In iOS 10, if you select an input with a placeholder, the placeholder text will show on the keyboard like so:
The text color however is very light and difficult to read.
Is there a way to change this color?
Upvotes: 0
Views: 1076
Reputation: 2533
This will make it easy to control the place holder color inside of the storyboard
@IBInspectable var placeHolderColor: UIColor? {
didSet {
let rawString = attributedPlaceholder?.string != nil ? attributedPlaceholder!.string : ""
let str = NSAttributedString(string: rawString, attributes: [NSForegroundColorAttributeName: placeHolderColor!])
attributedPlaceholder = str
}
}
Upvotes: 0
Reputation: 1854
There is!
Connect your text field to your viewController, then assign it a color programmatically.
myTextField.setPlaceholderColor(UIColor.black)
Upvotes: 3