textFieldShouldEndEditing
Request the delegate if editing should stop in the specified text box.
- (BOOL)textFieldShouldEndEditing:(UITextField *)textField
Discussion This method is called when the text field is prompted to write off the first responder status. This can happen when your application asks for a text field to cancel focus or when a user tries to change the editing to focus on another control. However, before the focus really changes, the text box calls this method to give your delegate the opportunity to decide whether to do so.
Usually you return YES from this method to allow text to remove the status of the first responder. You can return NO, however, in cases where your delegate finds invalid content in the text box. By returning NO, you can prevent the user from switching to another control until the text field contains a valid value.
textFieldDidEndEditing
Informs the delegate that editing is stopped for the specified text field.
- (void)textFieldDidEndEditing:(UITextField *)textField
Discussion This method is called after the text field leaves its status as the first responder. This method can be used to update delegate status information. For example, you can use this method to hide overlay views that should only be visible during editing. Implementation of this method by the delegate is optional.
Website: apple.com textFieldShouldendEditing
textFieldShouldEndEditing
textFieldDidEndEditing
source share