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

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

문제

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)

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top