UITextField "value changed" not firing when field is updated

Solution 1:

Don't use UIControlEventValueChanged for UITextField. What you want is UIControlEventEditingChanged.

Solution 2:

To get EditingChanged textfield event, I suggested add selector as

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

As textfield value changed, the changed value you will get from this textChanged: selector.

-(void)textChanged:(UITextField *)textField
{
    NSLog(@"textfield data %@ ",textField.text);
}

Solution 3:

IF you are assigning a delegate to the text field then note that (when you return NO from the delegate method below, the event (Editing changed) won't be triggered. Consider invoking the event listener when you do return NO from this method

(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string

Solution 4:

An old question, but the first search result I found, and none of the answers are satisfactory. I found this solution to work best: Swift UITextField subclass handle text change programmatically.

Override UITextField's text property to add a didSet(), and call your value changed function from there.

  override open var text: String? {
        didSet {
            myValueDidChange()
        }
    }