VMaskTextField icon indicating copy to clipboard operation
VMaskTextField copied to clipboard

VMaskTextField addTarget forControlEvents:UIControlEventEditingChanged

Open KanybekMomukeyev opened this issue 8 years ago • 2 comments

@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);
}

KanybekMomukeyev avatar Oct 10 '16 08:10 KanybekMomukeyev

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 avatar Jan 22 '17 01:01 felipeferri

@felipeferri Good!, already fix that issue

KanybekMomukeyev avatar Jan 22 '17 07:01 KanybekMomukeyev