Tap on UITextField's clear button hides keyboard instead of clearing text
问题 In iPhone, I have a view which has a UITextField . When I tap on the clear button of UITextField 's the keyboard dismissed instead of clearing the text in the UITextField . On an iPad it is working correctly. What can I do to fix this? 回答1: Just clear the field, resignFirstResponder (if you want to hide keyboard) and return NO / false Note: set Attributes inspector property of UITextField Clear Button -> Appears while editing so it will display the clear button while editing in the text field