user2585611 user2585611 - 2 years ago 166
iOS Question

Change placeholder text color on swift

How do I change the placeholder text color of a UITextField through Swift? I can't seem to access the placeholder attribute. Thanks

Answer Source

You can set the placeholder text using an Attributed string. Set color to attributes Property.

   textField.attributedPlaceholder = NSAttributedString(string:"placeholder text",
   attributes:[NSForegroundColorAttributeName: UIColor.yellowColor()])
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download