Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VMaskTextField addTarget forControlEvents:UIControlEventEditingChanged #19

Open
KanybekMomukeyev opened this issue Oct 10, 2016 · 2 comments

Comments

@KanybekMomukeyev
Copy link

KanybekMomukeyev commented Oct 10, 2016

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

@felipeferri
Copy link
Contributor

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];

@KanybekMomukeyev
Copy link
Author

@felipeferri Good!, already fix that issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants