Objective-c – UIControlEvents and subclassing UIControl


I have a UIControl subclass for a custom slider type control (one that behaves differently from UISlider). At the moment I use my own target and action variables to send a message to the target whenever the slider value changes. But this doesn't play nice with Apple's UIControlEvent constants. I wasn't sure if I should use these, and if so, where can I put my custom "value changed" detection?

I overrode beginTrackingWithTouch: and continueTrackingWithTouch: to return YES but the action is never dispatched.

Best Solution

Every time the value changes you call [self sendActionsForControlEvents:UIControlEventValueChanged] and the control will handle the rest.