user2585611 user2585611 - 7 months ago 30
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()])