UITextField Delegate

- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField;        // return NO to disallow editing.  返回NO 文本框不可编辑

- (void)textFieldDidBeginEditing:(UITextField *)textField;           // became first responder    当前文本框变为第一响应者的时候触发这个事件

- (BOOL)textFieldShouldEndEditing:(UITextField *)textField;          // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end

- (void)textFieldDidEndEditing:(UITextField *)textField;             // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;   // return NO to not change text

- (BOOL)textFieldShouldClear:(UITextField *)textField;               // called when clear button pressed. return NO to ignore (no notifications)

- (BOOL)textFieldShouldReturn:(UITextField *)textField;              // called when 'return' key pressed. return NO to ignore.  文本框点击键盘的上得return 键时调用。

1
原文地址:https://www.cnblogs.com/fantasy3588/p/5379810.html