Tag: 快速

UITextField文本更改事件

如何检测textField中的任何文本更改? delegate方法shouldChangeCharactersInRange适用于某些东西,但它并没有完全满足我的需要。 由于直到它返回YES,textField文本不可用于其他观察者方法。 例如在我的代码中, calculateAndUpdateTextFields没有获得更新的文本,用户已经输入。 他们有什么办法像textChanged Java事件处理程序。 – (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { if (textField.tag == kTextFieldTagSubtotal || textField.tag == kTextFieldTagSubtotalDecimal || textField.tag == kTextFieldTagShipping || textField.tag == kTextFieldTagShippingDecimal) { [self calculateAndUpdateTextFields]; } return YES; }