3

I have looked at all the similar questions and they are different than from what I am asking. I need to catch a change in the actual text in the UITextField, not just the state of editing. It will be a first responder when the view loads, and I need to know when text is entered so that I can enable "Next" in the navigation bar. Please help me if you can it's really holding me back in my project.

Addition: I am currently using - it doesn't work:

[textField addTarget:self action:@selector(textFieldDidChange)    forControlEvents:UIControlEventValueChanged];
Redneys
  • 285
  • 1
  • 6
  • 18

2 Answers2

3

Implement UITextFieldDelegate protocol, and respond to the textField:shouldChangeCharactersInRange:replacementString: method.

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)replacementStr {
    // Enable "Next" if you like what's entered in the replacementStr
}
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523
0

Check the developer documents for UITextFieldDelegate, specifically this method

8vius
  • 5,786
  • 14
  • 74
  • 136