CCControlPotentiometer Class Reference
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
-
– initWithTrackSprite:progressSprite:thumbSprite:
Initializes a potentiometer with a track sprite and a progress bar.
-
+ potentiometerWithTrackFile:progressFile:thumbFile:
Creates potentiometer with a track filename and a progress filename.
Accessing the Potentiometer’s Value
-
value
Contains the receiver’s current value.
property -
– setValue:animated:
Sets the receiver’s current value, allowing you to animate the change visually.
Accessing the Potentiometer’s Value Limits
-
minimumValue
Contains the minimum value of the receiver. The default value of this property is 0.0.
property -
maximumValue
Contains the maximum value of the receiver. The default value of this property is 1.0.
property
Customizing the Appearance of the Slider
-
onThumbTintColor
The color used to tint the appearance of the thumb when the potentiometer is pushed.
property
Properties
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
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