hyn
hyn

Reputation: 473

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.

Upvotes: 18

Views: 5664

Answers (2)

tdubik
tdubik

Reputation: 11

Make sure that you are passing touchesBegan and other inherited methods to super class.

Upvotes: 1

Ben Stiglitz
Ben Stiglitz

Reputation: 4004

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

Upvotes: 32

Related Questions