Implementing an onValueChange for a UISwitch in OBJ-C but not when the user touches/changes the value

StackOverflow https://stackoverflow.com/questions/21587492

Question

Is there way to implement an onValueChange listener in Xcode/Objective C for an UISwitch but not an onTouch listener? So I want a method to be called when the value of the UISwitch changes without user input. (This will happen programatically via a text SMS service)

Était-ce utile?

La solution

The listener is only called when the UISwitch gets toggled by the user touching it. If you programmatically set it, the listener won't be called. But since you're programmatically changing it, just call your listener yourself at the time you change it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top