Reputation: 11
I have UITextField with grey text "username", while this field aren't selecting by user . How can I change color to black, when user select this field and will begin type his username? Sry my English
Upvotes: 0
Views: 659
Reputation: 445
Just set the placeHolder
text as "username" and it will be displayed in grey color then set the textColor of your textField as black color so when you will begin editing you will edit with blackcolor
Upvotes: 0
Reputation: 3370
I think you're approaching it the wrong way. From what I read i think that you need to go with "placeholder" text.
Open your xcode project, go to your .xib or .storyboard file, click on your UITextField
and input 'username' on the Placeholder
textfield, like the following image:
The placeholder
text is a gray text that is displayed when your UITextField
is empty.
Upvotes: 2
Reputation: 10045
Use the placeholder
property of UITextField for the grayed text that will be replaced with whatever user types in.
Upvotes: 0