You don’t even need to implement a delegate. I prefer to use a nice, old-fashioned goal / action pattern to handle this. This can also lead to cleaner code if you have several ways to stop editing (for example, intercepting strokes outside the text box to cancel editing).
To use a target / action, just plug UIControlEventEditingDidEndOnExitin which is displayed as an event in Interface Builder Did End On Exit.
No mousse, no fuss. Much cleaner and easier than implementing a delegate.
source
share