How to clear a textfield of its default text immediately upon tapping on the text field?

I'm in the middle of creating an app. The app launches with text displayed by default in the text field, e.g.: "Enter video name here:".


I would like for that text to be deleted immediately when the user taps within that text field to enter his/her own desired text. Is there a way to do this in Xcode. I see that there is a "clear" button that can be chosen. But I would like for the default text to be deleted immediately when the user clicks within the text field for the first time.


If someone could plese let me know how to do that, I would greatly appreciate it. Please help. Thank you.

Answered by Claude31 in 396878022

The best is to put the text "Enter video name here:" in the placeHolder.


It will appear dimmed and will be cleared as soon as user types into the field

It will reappear if user exit the field leaving it empty.

Accepted Answer

The best is to put the text "Enter video name here:" in the placeHolder.


It will appear dimmed and will be cleared as soon as user types into the field

It will reappear if user exit the field leaving it empty.

Thank you, I appreciate it!

How to clear a textfield of its default text immediately upon tapping on the text field?
 
 
Q