user2585611 user2585611 - 3 months ago 10x
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


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()])