TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2015 |
Maintained by Ellen Shapiro, Aaron Shekey.
A slider control with auto-appearing ticks and saturating images at each end. Straight from the codebase of Hum.
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
.
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.
pointAdjustmentForCustomThumb
property to compensate for this. UIImageRenderingModeAlwaysTemplate
in order to facilitate the saturation and desaturation of the image using tint colors.saturatedColor
or desaturatedColor
properties, it will set the same color on both sides. Use the setSaturatedColor:forSide:
and setDesaturatedColor:forSide
to set separate colors per side.