For a UITextField, what is the best way to detect if the user is typing and the textfield has a value?
I've tried the following unsuccessfully:
- Value Changed: no response
- Editing Did End: no response
- Touch Up Inside: doesn't trigger until after the user clicks out of the textfield
Try using the
shouldChangeCharactersInRange
event.This is called whenever a user adds or removes a new character to your
UITextField
.If you want to accept the change,
return true
. Otherwisereturn false
.Just make sure your UITextField conforms to the
UITextFieldDelegate
Protocol