Bi-directional Adjustable slider slider __ios for IOS development

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.