Skip to content

Editing Changed

Published:
1 min read

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.

UIControlEventEditingChangedMeet our hero! You can either assign an IBAction for this event in Interface Builder or add a target and action in code.

[self.textField addTarget:self action:@selector(textFieldDidChangeText:) forControlEvents:UIControlEventEditingChanged];

New posts, shipping stories, and nerdy links straight to your inbox.

2× per month, pure signal, zero fluff.


Edit on GitHub
Share this post on: