Search code examples
iphoneuitextfieldkey-value-observing

UITextField valueDidChange-Event


Is there a way to catch a "valueDidChange"-Event for a Textfield? oO

I've got a modalView with an UITextField.

When the UITextField is empty, the "Done"-Button in the NavigationBar should be disabled and when there is Text entered, it should become enabled.

Right now the only way to accomplish this by using the "textFieldShouldReturn"-Method. This works but is simply horrible for usability.

Isn't there a way to check the requirements every time a letter is being entered or removed?


Solution

  • Implement -textField:shouldChangeCharactersInRange:replacementString:.