Reputation: 758
Is it possible to catch a clear button method from a UITextField somehow and then and give it more things to do like clear annotations on a map etc ?
On which method I need to catch to additional with the clear button ?
Thanks for help and fast answer
Upvotes: 0
Views: 65
Reputation: 119021
You can set yourself as the text field delegate and implement textField:shouldChangeCharactersInRange:replacementString:
. If the range
is the full range of the textField.text
and the replacement string
is equal to @""
then it is a clear operation.
Note that the user manually selecting all text and hitting backspace on the keyboard will have the same result.
Upvotes: 2