UITextField对象的方法状态是forControlEvents:UIControlEventEditingChanged
- (IBAction)textFieldDidChange:(UITextField *)sender { if (![_paidPwdField.text hasPrefix:_paidPwdAgainField.text]) { _hud = [MBProgressHUD showHUDAddedTo:[[UIApplication sharedApplication].windows lastObject] animated:YES]; _hud.userInteractionEnabled = NO; _hud.mode = MBProgressHUDModeCustomView; _hud.detailsLabelText = @"再次输入密码与上次输入密码不一致"; [_hud hide:YES afterDelay:1]; }}