As a general note, be sure to check out the class hierarchy, e.g. the superclasses of widgets, to see what other methods are available to the widgets that inherit from them.
You don't necessarily need to subclass UISlider
, but you may want to subclass it or, depending on what you're doing, UIControl
, if you think re-usability would be worthwhile.
UISlider
is a subclass of UIControl
, which is a subclass of UIView
.
UIControl
is a 'widgetized' UIView
, in other words, insofar as it provides methods primarily that facilitate detection of user input, and support for sending events, features that would tend to be common to any UI control widget.
For movement and position detection, the UIControl
class has methods beginTracking()
, continueTracking()
, endTracking()
, cancelTracking()
, isTracking()
, isTouchInside()
. Those are available directly from the UISlider
object.
Similarly, you can explicitly trigger actions (events) with sendAction()
and sendActions()
, made public by UIControl
thus implicitly available to UISlider
.
If you don't need to subclass, you can write a "one-off" (e.g. app-specific) bit of code to utilize the aforementioned methods directly through your UISlider
instance, directly tracking the 'touches' to the widget and delivering events at key positions along the slide path, or with specific behaviors you detect.
See this question, "IPhone: How to detect end of slider drag" for implementation ideas.
Apple's UIControl documentation has a subclassing notes section explaining how to use the target-action mechanism.