UITextField "value changed" not firing when field is updated

Andrew Lauer Barinov picture Andrew Lauer Barinov · Nov 22, 2011 · Viewed 53.7k times · Source

I have an IBAction that I have connected to a UITextField element in Interface Builder. (Firing on "value changed" event)

I also have a UISlider that updates the TextField element automatically when it's value gets adjusted.

When I run my app, the TextField does get updated when I adjust the slider, but the "value changed" event does not fire when this happens. The value changed event also does not fire when I edit the TextField by hand as well. (Although using the Did Editing End trigger does cause it to fire).

My question is, how can I get the value changed trigger to fire for both a programmatic update of the TextField as well as when the user adjusts the value.

Answer

Mark Adams picture Mark Adams · Nov 22, 2011

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