I am using a material design library for ios but i didn't found any property on how to change it's placeholder colour when there is no data entered. I have to use a standard background and the placeholder is not visible if it's gray
Asked
Active
Viewed 1,311 times
0
-
Why material design? That's Android UI, not iOS. – tktsubota Feb 22 '16 at 01:50
-
Client wants web, ios and android to have similar design. And because the web was first and uses material, everything else has to be material. Also that library is great. – Dr.Agos Feb 22 '16 at 02:00
4 Answers
2
You can use an attributed string for this:
let attrString = NSAttributedString(string: "Text", attributes: [NSForegroundColorAttributeName:UIColor.blueColor()])
myTextField.attributedPlaceholder = attrString

pxpgraphics
- 1,357
- 11
- 21
1
Version 1.34.5 allows the textField placeholder text color to be set like so:
textField.placeholderTextColor = MaterialColor.grey.base

CosmicMind
- 1,499
- 1
- 10
- 6
1
Use ATKit.
Refer: https://aurvan.github.io/atkit-ios-release/index.html
ATTextView Class: https://aurvan.github.io/atkit-ios-release/helpbook/Classes/ATTextView.html
Code:
import ATKit
@IBOutlet weak var messageTextView :ATTextView!
self.messageTextView.placeholderColor = UIColor(red: 173.0/255.0, green: 216.0/255.0, blue: 230.0/255.0, alpha: 1.0)
Screenshot:

Rupendra
- 89
- 1
- 2
-1
https://github.com/CosmicMind/Material/issues/169
See issue 169 on this. Release 1.34.0 includes this ability.
EDIT
New code in Material library is
textField.placeholderTextColor = MaterialColor.green.base

Craig.Pearce
- 746
- 7
- 25