When “Done” is pressed I know textViewDidEndEditing: is called. It is also sometimes called by other actions.
I want a method that is only called when “Done” is pressed — exclusively. I’ve been reading around for snippets of code, but don’t see anybody doing this. I am not using any XIB for my view, by the way.
Is this possible?
Firstly, the textFieldDidEndEditing is called not when the user taps the DONE button. It is called as soon as you touch anything after editing.
For having an exclusive button ‘Done’ you can create a Done key as a UIBarButtonItem, and write an IBAction like
The following line assigns the Done key as the Return Key.
You can check if the Done key was pressed in the TextFieldDidEndEditing…You may also use another button, and return it instead.