artemkrachulov / AKMaskField

Swift plugin which allow add mask to input field
MIT License
346 stars 131 forks source link

textFieldDidChange not working #38

Open mahirekici opened 7 years ago

mahirekici commented 7 years ago

Hi help me

didChanged not working ?

@IBOutlet weak var cep: AKMaskField! cell?.cep.addTarget(self, action: #selector(textFieldDidChange(textField:)), for: .editingChanged) func textFieldDidChange(textField: UITextField){ print(textField.text)}

lfarah commented 7 years ago

Hey @mahirekici, you gotta use the AKMaskFieldDelegate instead of UITextfieldDelegate. Take a look at this

bmcurutan commented 6 years ago

@lfarah I haven't been able to get any of the delegate methods to work. I'm already using .maskDelegate/AKMaskFieldDelegate instead of of the usual .delegate/UITextFieldDelegate

lfarah commented 6 years ago

@bmcurutan did you set these variables in this order? If you don't set the delegate before the expression and template, it won't work.

txtBirthdate.maskDelegate = self
txtBirthdate.maskExpression = "{dd}/{dd}/{dddd}"
txtBirthdate.maskTemplate = "  /  /    "
bmcurutan commented 6 years ago

2 Solutions:

Thanks