justhum / HUMSlider

A slider control with auto-appearing ticks and saturating images at each end. Straight from the codebase of Hum.
http://justhum.com/
MIT License
264 stars 31 forks source link

HUMSlider

A slider control with auto-appearing ticks and saturating images at each end. Straight from the codebase of Hum.

Setup

To use this control, we strongly recommend using CocoaPods. To do so add the following to your Podfile:

pod 'HUMSlider', ~>'1.0'

and then pod install.

Usage

A quick programmatic example of the most common use case:

    HUMSlider *slider = [[HUMSlider alloc] init];

    // Set the images to be saturated and desaturated
    slider.minimumValueImage = [UIImage imageNamed:@"minImage"];
    slider.maximumValueImage = [UIImage imageNamed:@"maxImage"];

    // What color should the image be when the thumb is close to it?
    slider.saturatedColor = [UIColor greenColor];

    // What color should the image be when the thumb is not close to it?
    slider.desaturatedColor = [[UIColor redColor] colorWithAlpha:0.5f]; 

    // How many ticks do you want?
    slider.sectionCount = 11; // This should be an odd number.

    // What color should the ticks be?
    slider.tickColor = [UIColor blackColor];    

Full code is available in the sample app included in this repo.

Usage notes

Contributors