Using Xcode v7.2 - iOS v9.2 - iPhone5S Swift
I am trying to create a transparent UITextField, with a light gray placeholder text.
I have used:
self.userEmailTextField.backgroundColor = UIColor.clearColor()
The placeholder text disappears, however it appears when using whiteColor, or blueColor backgrounds.
white background:

clear background:

Placeholder is not visible due to your clear background color.You can check it by setting palceholder color like this...
In Swift...
if let _ = self.placeholder{
self.txtField.attributedPlaceholder = NSAttributedString(string:self.placeholder!,
attributes:[NSForegroundColorAttributeName: UIColor.whiteColor()])
}
In Objective c...
[textField setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With