Reputation: 14470
I am having difficulty with the last argument in the function call..
myTextField.attributedPlaceholder = NSAttributedString(string: "Wage Type", attributes: NSForegroundColorAttributeName: ??????)
I am not sure how to set the colour of the placeholder using this method.
Upvotes: 3
Views: 3740
Reputation: 3993
So the initializer you're using looks like this:
init(string aString: String!, attributes attributes: [NSObject : AnyObject]!)
It is expecting a dictionary mapping attribute keys to values. Check out this document to find the expected key/value pairings. So if all you want to do is change the text color, you could try this:
let attributesDictionary = [NSForegroundColorAttributeName: UIColor.greenColor()]
myTextField.attributedPlaceholder = NSAttributedString(string: "Wage Type", attributes: attributesDictionary)
Let me know if you have any further questions regarding this!
Upvotes: 10