Reputation: 17169
I have a UITextView which I want to call some code after leaving it. How I can do this?
Thanks.
Upvotes: 0
Views: 140
Reputation: 34945
The UITextFieldDelegate
protocol has a textFieldShouldEndEditing:
method. This method will be called before the text field resigns the first responder status. For example when another control is selected.
This is a good place to put code that needs to run after the user is done working in the text field.
You can also prevent the user from leaving the text field by returning NO from this method. This is useful when you for example want to show an error message or error marker next to the field.
Upvotes: 1