sliders are used in many places, so here we show you a custom, two-way-controlled slider, and you can get the corresponding range values through the proxy method, some of the code is as follows:
Property Value:
/**
Set minimum value
*/
@property (nonatomic,assign) cgfloat minnum;
/**
Set maximum value
*/
@property (nonatomic,assign) cgfloat maxnum;
/**
Set min color
*/
@property (nonatomic,weak) Uicolor *mintintcolor;
/**
Set Max color
*/
@property (nonatomic,weak) Uicolor *maxtintcolor;
/**
Set Middle Color
*/
@property (nonatomic,weak) Uicolor *maintintcolor;
/**
Display a smaller number label
*/
@property (Nonatomic,strong) Uilabel *minlabel;
/**
Display a larger number label
*/
@property (Nonatomic,strong) Uilabel *maxlabel;
/**
Current minimum value
*/
@property (nonatomic,assign) cgfloat currentminvalue;
/**
Current Maximum Value
*/
@property (nonatomic,assign) cgfloat currentmaxvalue;
/**
Show min Slider
*/
@property (Nonatomic,strong) UIButton *minslider;
/**
Show Max Slider
*/
@property (Nonatomic,strong) UIButton *maxslider;
/**
Set up units
*/
@property (nonatomic,copy) nsstring * unit;
Depending on these, you can display the desired color style,
How to use:
_slider = [[Jldoubleslider alloc]initwithframe:cgrectmake (0, 0, 300, 40)];
_slider.unit = @ "¥";
_slider.minnum = 14;
_slider.maxnum = 59;
_slider.mintintcolor = [Uicolor Redcolor];
_slider.maxtintcolor = [Uicolor Bluecolor];
_slider.maintintcolor = [Uicolor blackcolor];
[Self.view Addsubview:_slider];
Interface Effect:
SOURCE Download: Https://github.com/hbblzjy/JLDoubleSliderDemo