Reputation: 10056
So I have some basic textfields with a custom background, that is a line at the bottom and the rest of it it's transparent, but now the placeholders don't show anymore.
These are the text fields
And config
Upvotes: 2
Views: 3934
Reputation: 1311
I had the same problem. Turns out it had nothing to do with me having set borderStyle
to UITextBorderStyleNone
. It was caused by me subclassing UITextField
to add a manually drawn border along the bottom only and failing to call the super implementation in my override of layoutSubviews
. Once I had sorted that, my placeholder text was back.
Upvotes: 1
Reputation: 516
It's better to do this:
if ([self.textField respondsToSelector:@selector(setAttributedPlaceholder:)]) {
self.textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:self.textField.placeholder attributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}];
}
Upvotes: 1
Reputation: 10056
I have found a solution that works, you need to select the input and set the following on User Defined Runtime Attributes
Upvotes: 2