UITextField clear when selected, but also restore data if nothing is input
问题 I have a table with UITextFields, and I want to make it so that when a textfield is selected, the current info is cleared (to allow new input), but if the user decides (after selecting) that they don't want to change it, I want them to be able to click elsewhere and the data from before reappears in the textfield. Is there an easy way to do this? 回答1: A good way to do this that's nice and user friendly is to use the placeholder property. Set up your viewController as the textfield's delegate