Home > DeveloperSection > Forums > Detecting value changed in UITextField
Steven Hill
Steven Hill

Total Post:10

Points:72
Posted on    October-28-2015 1:48 AM

 iPhone iPhone  Ios  Objective C 
Ratings:


 1 Reply(s)
 561  View(s)
Rate this:

I was creating an iPhone app and having a situation when I need to detect if the text field value is changed every time. The UITextFieldDelegate method shouldChangeCharactersInRange works but it’s not fully useful for me because it returns YES, so the texts of textField are not being available to other methods.

I want something like Java textChanged event handler, can anyone help me.



Tarun Kumar

Total Post:213

Points:1635
Supported
Posted on    October-28-2015 2:00 AM

Yes, your problem is thinkable but I have a solution for your problem. For the text field control add a notificationMethod “textFieldDidChange”.
For example:

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

Now, the textFieldDidChange: method will be called whenever you will change any value and also it can reload your table view as needed.


Don't want to miss updates? Please click the below button!

Follow MindStick