As we know that we can't change the place holder color of the Text Fields but sometimes if we need to change it then we can do it by using following code.
UIColor *color = [UIColor grayColor];
self.myTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Username" attributes:@{NSForegroundColorAttributeName:color}];
Here, First we have to make a instance of UIColor type, and assign any color to it for example we need to display the text of the Text Field in gray Color so we have written greyColor.
In next line code myTextFeild is the Text Field's outlet whose placeholder color we want to change. We have also mentioned one string i.e @"Username" , it is the text which would be written in the Text Field.
so in this way we can change the place holder color of a Text Field.
0 Comment(s)