Reputation:
I have a bunch of text fields that I have initial values that tell the user what to enter. i.e. name. When the user initially selects the text field I want the initial value to be cleared. My searching led me to this type of function. but It's not clearing the initial values.
func textFieldDidBeginEditing(textField: UITextField) {
orginalMortgageAmount.text = ""
currentMortgageAmount.text = ""
}
Upvotes: 0
Views: 522
Reputation: 5241
You should use placeholder. Text field has a separate property placeholder
that accepts string. When the user starts typing, the placeholder becomes empty automatically. Other functionalities like the text become again visible if user deletes all characters is provided by default. You can also add placeHolder text in Storyboard.
Upvotes: 1