VMaskTextField
VMaskTextField copied to clipboard
VMaskTextField addTarget forControlEvents:UIControlEventEditingChanged
@viniciusmo , any ideas, why textField add target not working!
VMaskTextField *textField
[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
-(void)textFieldDidChange :(UITextField *)theTextField{
NSLog( @"text changed: %@", theTextField.text);
}
It's a problem in [VMaskEditor shouldChangeCharactersInRange:replacementString:textField:mask]. In that method the textField.text value is set manually on code. When this happens the UIControlEventEditingChanged event is not trigered.
A solution is to paste the following line of code just next to the places where the textField is set in that method:
textField.text = returnText;
[textField sendActionsForControlEvents:UIControlEventEditingChanged];
@felipeferri Good!, already fix that issue