The UISlider slider control is commonly used in iOS development to adjust UI interactions such as volume, font size, and the usage summary is as follows:
Initialize a slider:
?
| 1 |
UISlider * slider = [[UISlider alloc]initWithFrame:CGRectMake(0, 0, 100, 100)]; |
Set the position of the slider
@property (nonatomic) float value;
This value is between the maximum and minimum values of the slider, and if no boundary value is set, the default is 0-1;
Set the slider minimum boundary value (default = 0)
@property (nonatomic) float MinimumValue;
Set slider maximum boundary value (default = 1)
@property (nonatomic) float MaximumValue;
Set the picture that appears at the leftmost end of the slider:
@property (Nonatomic,retain) UIImage *minimumvalueimage;
Set the picture that appears at the right end of the slider:
@property (Nonatomic,retain) UIImage *maximumvalueimage;
Sets whether the slider value changes continuously (default = yes)
@property (nonatomic,getter=iscontinuous) BOOL continuous;
When this property is set to Yes, its value changes at any time and is set to no when it is sliding, and value changes when the swipe ends.
Sets the color of the left (less than part) line of the slider
@property (Nonatomic,retain) Uicolor *minimumtracktintcolor;
Set the color of the line to the right (greater than part) of the slider
@property (Nonatomic,retain) Uicolor *maximumtracktintcolor;
Set the slider color (affects colors that have crossed one end)
@property (Nonatomic,retain) Uicolor *thumbtintcolor;
Note This property: If you do not set the slider of the picture, that this property will only change the color has been across a line, will not change the color of the slider, if you set the slider picture, and set this property, then the slider picture will not display, the color of the slider will change (IOS7)
To manually set the value of the slider:
-(void) SetValue: (float) value animated: (BOOL) animated;
To set the picture for the slider:
-(void) Setthumbimage: (UIImage *) image forstate: (uicontrolstate) state;
Set the line pattern across a section of the slider
-(void) Setminimumtrackimage: (UIImage *) image forstate: (uicontrolstate) state;
Set the line pattern that the slider does not slide across the section
-(void) Setmaximumtrackimage: (UIImage *) image forstate: (uicontrolstate) state;
Several of the corresponding Get methods
-(UIImage *) Thumbimageforstate: (uicontrolstate) state;
-(UIImage *) Minimumtrackimageforstate: (uicontrolstate) state;
-(UIImage *) Maximumtrackimageforstate: (uicontrolstate) state;
Corresponding method for setting the response property of the current state
@property (nonatomic,readonly) uiimage* currentthumbimage;
@property (nonatomic,readonly) uiimage* currentminimumtrackimage;
@property (nonatomic,readonly) uiimage* currentmaximumtrackimage;
To add a trigger event
?
| 1 |
[slider addTarget:self action:@selector(log:) forControlEvents:UIControlEventValueChanged]; |
IOS UISlider Usage Summary