监听UITextField 文本变化,退格等

#pragma mark - UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
   
    NSMutableString *text = [NSMutableString stringWithString:textField.text];
    [text replaceCharactersInRange:range withString:string];
    NSLog(@"shouldChangeCharactersInRange: %@", text);
    
    return YES;
}

你可能感兴趣的:(监听UITextField 文本变化,退格等)