Giter Site home page Giter Site logo

rakutou / humslider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from justhum/humslider

0.0 2.0 0.0 471 KB

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

Home Page: http://justhum.com/

License: MIT License

Ruby 1.52% Objective-C 98.48%

humslider's Introduction

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

  • The number of ticks must be odd - otherwise pretty much all the math for centering things breaks spectacularly. Attempting to add an even number of ticks will cause an assertion failure during development.
  • If you are using a custom thumb image which has some clear space at the top, use the pointAdjustmentForCustomThumb property to compensate for this.
  • This control defines its own intrinsic content height based on how high the ticks will pop up, but does not define its own intrinsic content width.
  • Images passed in as min/max images will automatically be set to use UIImageRenderingModeAlwaysTemplate in order to facilitate the saturation and desaturation of the image using tint colors.
  • Images will perform best when they're un-styled. Let the code set the colors.
  • If no min/max images are passed in, the slider track will take up the full length of the control.
  • If you set the 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.

#Contributors

humslider's People

Contributors

aaronshekey avatar designatednerd avatar kamilgryniewicz avatar streeter avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.