views:

110

answers:

2

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?

+1  A: 

Implement -textField:shouldChangeCharactersInRange:replacementString:.

KennyTM
The Problem here is:-textField:shouldChangeCharactersInRange:replacementString:gets called BEFORE the character has been inserted.What I need would be a call AFTER the character has been inserted.I could still work with this, if i knew how to use the range and replacementstring parameters to construct the resulting total string
Infinite
If anybody cares: the solution is to catch the control event "EditingChanged" with addTarget:selector:controlevent:
Infinite
@Infinite: You may want to put that as an answer and accept yourself.
KennyTM
A: 

If anybody cares: the solution is to catch the control event "EditingChanged" with addTarget:selector:controlevent: ;)

Infinite