Inherits from CCControl : CCLayer
Declared in CCControlPotentiometer.h

Overview

Potentiometer control for Cocos2D.

A CCControlPotentiometer object is a visual control used to select a single value in a circular motion from a continuous range of values. An indicator notes the current value of the potentiometer and can be moved by the user to change the setting.

Tasks

Creating Potentiometers

Accessing the Potentiometer’s Value

Accessing the Potentiometer’s Value Limits

Customizing the Appearance of the Slider

  •   onThumbTintColor

    The color used to tint the appearance of the thumb when the potentiometer is pushed.

    property

Properties

maximumValue

Contains the maximum value of the receiver. The default value of this property is 1.0.

@property (nonatomic, assign) float maximumValue

Discussion

Contains the maximum value of the receiver. The default value of this property is 1.0.

Declared In

CCControlPotentiometer.h

minimumValue

Contains the minimum value of the receiver. The default value of this property is 0.0.

@property (nonatomic, assign) float minimumValue

Discussion

Contains the minimum value of the receiver. The default value of this property is 0.0.

Declared In

CCControlPotentiometer.h

onThumbTintColor

The color used to tint the appearance of the thumb when the potentiometer is pushed.

@property (nonatomic, assign) ccColor3B onThumbTintColor

Discussion

The default color is ccGRAY.

Declared In

CCControlPotentiometer.h

value

Contains the receiver’s current value.

@property (nonatomic, assign) float value

Discussion

Setting this property causes the receiver to redraw itself using the new value. To render an animated transition from the current value to the new value, you should use the setValue:animated: method instead.

If you try to set a value that is below the minimum or above the maximum value, the minimum or maximum value is set instead. The default value of this property is 0.0.

Declared In

CCControlPotentiometer.h

Class Methods

potentiometerWithTrackFile:progressFile:thumbFile:

Creates potentiometer with a track filename and a progress filename.

+ (id)potentiometerWithTrackFile:(NSString *)backgroundFile progressFile:(NSString *)progressFile thumbFile:(NSString *)thumbFile

Discussion

Creates potentiometer with a track filename and a progress filename.

Declared In

CCControlPotentiometer.h

Instance Methods

initWithTrackSprite:progressSprite:thumbSprite:

Initializes a potentiometer with a track sprite and a progress bar.

- (id)initWithTrackSprite:(CCSprite *)trackSprite progressSprite:(CCProgressTimer *)progressTimer thumbSprite:(CCSprite *)thumbSprite

Parameters

trackSprite

CCSprite, that is used as a background.

progressTimer

CCProgressTimer, that is used as a progress bar.

thumbSprite

CCSprite, that is used as a thumb.

Discussion

Initializes a potentiometer with a track sprite and a progress bar.

Declared In

CCControlPotentiometer.h

setValue:animated:

Sets the receiver’s current value, allowing you to animate the change visually.

- (void)setValue:(float)value animated:(BOOL)animated

Parameters

value

The new value to assign to the value property.

animated

Specify YES to animate the change in value when the receiver is redrawn; otherwise, specify NO to draw the receiver with the new value only. Animations are performed asynchronously and do not block the calling thread.

Discussion

If you try to set a value that is below the minimum or above the maximum value, the minimum or maximum value is set instead. The default value of this property is 0.0.

See Also

Declared In

CCControlPotentiometer.h