Inherits from TouchableNode : CCNode : NSObject
Conforms to CCRGBAProtocol
Declared in Slider.h

Overview

A slider control. Contains a “knob” object, which slides along a “track” object. Both the track and the knob are supplied at object creation time, and the slider adjusts its contentSize according to the knob and track’s size as well as their scale factor.
This means that you can prescale the knob and/or track and still have a functioning slider.

Tasks

Properties

value

The position (value) of the slider in the track, as a proportion from 0.0 to 1.0

@property (readwrite, assign) float value

Declared In

Slider.h

Class Methods

sliderWithTrack:knob:padding:target:moveSelector:dropSelector:

Create a slider.

+ (id)sliderWithTrack:(CCNode *)track knob:(CCNode *)knob padding:(CGSize)padding target:(id)target moveSelector:(SEL)moveSelector dropSelector:(SEL)dropSelector

Parameters

track

The node to use as a track.

knob

The node to use as a knob.

padding

The amount of padding to add to the touchable area.

target

the target to notify of events.

moveSelector

the selector to call when the knob is moved (nil = ignore).

dropSelector

The selector to call when the knob is dropped (nil = ignore).

Return Value

a new slider.

Declared In

Slider.h

Instance Methods

initWithTrack:knob:padding:target:moveSelector:dropSelector:

Initialize a slider.

- (id)initWithTrack:(CCNode *)track knob:(CCNode *)knob padding:(CGSize)padding target:(id)target moveSelector:(SEL)moveSelector dropSelector:(SEL)dropSelector

Parameters

track

The node to use as a track.

knob

The node to use as a knob.

padding

The amount of padding to add to the touchable area.

target

the target to notify of events.

moveSelector

the selector to call when the knob is moved (nil = ignore).

dropSelector

The selector to call when the knob is dropped (nil = ignore).

Return Value

The initialized slider.

Declared In

Slider.h