CCControlSlider Class Reference
| Inherits from | CCControl : CCLayer |
| Declared in | CCControlSlider.h |
Overview
Slider control for Cocos2D.
A CCControlSlider object is a visual control used to select a single value from a continuous range of values. An indicator, or thumb, notes the current value of the slider and can be moved by the user to change the setting.
Tasks
Creating Sliders
-
+ sliderWithBackgroundFile:progressFile:thumbFile:Creates slider with a background filename, a progress filename and a thumb image filename.
-
+ sliderWithBackgroundSprite:progressSprite:thumbSprite:Creates a slider with a given background sprite and a progress bar and a thumb item.
-
– initWithBackgroundSprite:progressSprite:thumbSprite:Initializes a slider with a background sprite, a progress bar and a thumb item.
Accessing the Slider’s Value
-
valueContains the receiver’s current value.
property -
– setValue:animated:Sets the receiver’s current value, allowing you to animate the change visually.
Accessing the Slider’s Value Limits
-
minimumValueContains the minimum value of the receiver.
property -
maximumValueContains the maximum value of the receiver.
property
Customizing the Appearance of the Slider
-
onThumbTintColorThe color used to tint the appearance of the thumb when the slider is pushed.
property
Properties
maximumValue
Contains the maximum value of the receiver.
@property (nonatomic, assign) float maximumValueDiscussion
If you change the value of this property, and the current value of the receiver is above the new maximum, the current value is adjusted to match the new maximum value automatically.
The default value of this property is 1.0.
Declared In
CCControlSlider.hminimumValue
Contains the minimum value of the receiver.
@property (nonatomic, assign) float minimumValueDiscussion
If you change the value of this property, and the current value of the receiver is below the new minimum, the current value is adjusted to match the new minimum value automatically.
The default value of this property is 0.0.
Declared In
CCControlSlider.honThumbTintColor
The color used to tint the appearance of the thumb when the slider is pushed.
@property (nonatomic, assign) ccColor3B onThumbTintColorDiscussion
The default color is ccGRAY.
Declared In
CCControlSlider.hvalue
Contains the receiver’s current value.
@property (nonatomic, assign) float valueDiscussion
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
CCControlSlider.hClass Methods
sliderWithBackgroundFile:progressFile:thumbFile:
Creates slider with a background filename, a progress filename and a thumb image filename.
+ (id)sliderWithBackgroundFile:(NSString *)bgFile progressFile:(NSString *)progressFile thumbFile:(NSString *)thumbFileDiscussion
Creates slider with a background filename, a progress filename and a thumb image filename.
Declared In
CCControlSlider.hsliderWithBackgroundSprite:progressSprite:thumbSprite:
Creates a slider with a given background sprite and a progress bar and a thumb item.
+ (id)sliderWithBackgroundSprite:(CCSprite *)backgroundSprite progressSprite:(CCSprite *)pogressSprite thumbSprite:(CCSprite *)thumbSpriteDiscussion
Creates a slider with a given background sprite and a progress bar and a thumb item.
Declared In
CCControlSlider.hInstance Methods
initWithBackgroundSprite:progressSprite:thumbSprite:
Initializes a slider with a background sprite, a progress bar and a thumb item.
- (id)initWithBackgroundSprite:(CCSprite *)backgroundSprite progressSprite:(CCSprite *)progressSprite thumbSprite:(CCSprite *)thumbSpriteParameters
- backgroundSprite
CCSprite, that is used as a background.
- progressSprite
CCSprite, that is used as a progress bar.
- thumbSprite
CCSprite, that is used as a thumb.
Discussion
Initializes a slider with a background sprite, a progress bar and a thumb item.
Declared In
CCControlSlider.hsetValue:animated:
Sets the receiver’s current value, allowing you to animate the change visually.
- (void)setValue:(float)value animated:(BOOL)animatedParameters
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
CCControlSlider.h