Inherits from CCControl : CCNode : CCResponder : NSObject
Declared in CCSlider.h

Overview

A CCSlider object is a visual control used to select a single value from a continuous range of values. An indicator, or an handle, notes the current value of the slider and can be moved by the user to change the setting.

Properties

background

The background’s sprite 9 slice.

@property (nonatomic, readonly) CCSprite9Slice *background

Declared In

CCSlider.h

handle

The handle’s sprite.

@property (nonatomic, readonly) CCSprite *handle

Declared In

CCSlider.h

sliderValue

Contains the receiver’s current value. Setting this property causes the receiver to redraw itself using the new value. If you try to set a value that is below 0.0f or above 1.0f, the minimum or maximum value is set instead. The default value of this property is 0.0.

@property (nonatomic, assign) float sliderValue

Declared In

CCSlider.h

Instance Methods

backgroundSpriteFrameForState:

Gets the background’s sprite frame for the specified state.

- (CCSpriteFrame *)backgroundSpriteFrameForState:(CCControlState)state

Parameters

state

State to get the sprite frame for.

Return Value

Background sprite frame.

Declared In

CCSlider.h

handleSpriteFrameForState:

Gets the handle’s sprite frame for the specified state.

- (CCSpriteFrame *)handleSpriteFrameForState:(CCControlState)state

Parameters

state

State to get the sprite frame for.

Return Value

Handle sprite frame.

Declared In

CCSlider.h

initWithBackground:andHandleImage:

Initializes a new slider with a specified sprite frames for its background and handle.

- (id)initWithBackground:(CCSpriteFrame *)background andHandleImage:(CCSpriteFrame *)handle

Parameters

background

Stretchable background image which represents the track bar for the normal state.

handle

Handle image for the normal state.

Declared In

CCSlider.h

setBackgroundSpriteFrame:forState:

Sets the background’s sprite frame for the specified state. The sprite frame will be stretched to the preferred size of the label. If set to NULL no background will be drawn.

- (void)setBackgroundSpriteFrame:(CCSpriteFrame *)spriteFrame forState:(CCControlState)state

Parameters

spriteFrame

Sprite frame to use for drawing the background.

state

State to set the background for.

Declared In

CCSlider.h

setHandleSpriteFrame:forState:

Sets the handle’s sprite frame for the specified state. If set to NULL no handle will be drawn.

- (void)setHandleSpriteFrame:(CCSpriteFrame *)spriteFrame forState:(CCControlState)state

Parameters

spriteFrame

Sprite frame to use for drawing the handle.

state

State to set the handle for.

Declared In

CCSlider.h