CCPotentiometer Class Reference
Inherits from | CCControl : CCNode : CCResponder : NSObject |
---|---|
Declared in | CCPotentiometer.h |
Overview
Potentiometer control for Cocos2D.
A CCPotentiometer 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.
Creating Potentiometers
– initWithTrackSprite:progressSprite:thumbSprite:
Initializes a potentiometer with a track sprite and a progress bar.
- (id)initWithTrackSprite:(CCSprite *)trackSprite progressSprite:(CCProgressNode *)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. |
Declared In
CCPotentiometer.h
+ potentiometerWithTrackFile:progressFile:thumbFile:
Creates potentiometer with a track filename and a progress filename.
+ (id)potentiometerWithTrackFile:(NSString *)backgroundFile progressFile:(NSString *)progressFile thumbFile:(NSString *)thumbFile
Declared In
CCPotentiometer.h
Accessing the Potentiometer’s Value
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
CCPotentiometer.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 |
|
---|---|
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
CCPotentiometer.h
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 (nonatomic, assign) CCColor *onThumbTintColor
Discussion
The default color is ccGRAY.
Declared In
CCPotentiometer.h