Editing Changed
UITextViewDelegate
has a very useful method: -textViewDidChange:
. As the name implies, text view calls this method on its delegate whenever the text it is currently presenting is changed.
But, unlike UITextViewDelegate
, UITextFieldDelegate
doesn't have such a method. Instead, it has a hidden gem that provides the same functionality.
UIControlEventEditingChanged
Meet our hero! You can either assign an IBAction
for this event in Interface Builder or add a target and action in code.
This way, whenever a change appears on text field, it will call the action method assigned for UIControlEventEditingChanged
event.