11

I want to change Place holder color from user attributes (interface builder) because i dont want to subclass my UITextfield etc... i searched on internet and found this "_placeholderLabel.textColor" Yes this works well Programmatically [self.tfEmail setValue:[UIColor whiteColor] forKeyPath:@"_placeholderLabel.textColor"]; but i want to use it in user attributes in interface builder.

3 Answers 3

26

Try removing '_',

Image

Works for me.

Sign up to request clarification or add additional context in comments.

8 Comments

Lol I have never someone chance the placeholder like that in interface builder! aha awesome, i wonder what else you can create using that same method
simply awesome..!! Great buddy.
You can change Font you can change any property that exists. No need to do it programatically.
@Xeieshan, will it be for UITextField only or any control?
|
4

Without USING USER ATTRIBUTES

 self.txtField.attributedPlaceholder = PlaceHolderAttributedString(@"ABCDEF"); 

where PlaceHolderAttributedString is a macro defined as

 #define PlaceHolderAttributedString(placeHolderText) [[NSAttributedString alloc] initWithString:placeHolderText attributes:@{NSForegroundColorAttributeName:ColorTextFieldPlaceHolder}] 

USING USER ATTRIBUTES

 placeholderLabel.textColor 

Comments

0

in swift:

 one_textfield.setValue(UIColor.redColor(), forKeyPath: "_placeholderLabel.textColor") 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.