Giter Site home page Giter Site logo

hrishidev / markrangeslider Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vadymmarkov/markrangeslider

0.0 1.0 0.0 92 KB

A custom reusable slider control with 2 thumbs (range slider).

Home Page: https://github.com/vadymmarkov

License: Other

Ruby 2.91% Objective-C 97.09%

markrangeslider's Introduction

MARKRangeSlider

Version License Platform

A custom reusable slider control with 2 thumbs (range slider). Values range is between minimumValue and maximumValue (from 0 to 1 by default). The left thumb isn't able to go on the right side of the right thumb, and vice versa. Control enables multitouch (to use 2 fingers at 2 thumbs at the same time).

Please check Demo project for a basic example on how to use MARKRangeSlider.

Demo

Alt text

Available control properties

  • minimumValue - the minimum value of the slider's range (readonly)
  • maximumValue - the maximum value of the slider's range (readonly)
  • leftValue - the value of the left thumb (readonly)
  • rightValue - the value of the right thumb (readonly)
  • minimumDistance - the distance between 2 thumbs (thumbs can't be closer to each other than this distance)
  • pushable - allows the user to push both controls
  • disableOverlapping - disables the overlaping of thumb controls

Available control methods

  • (void)setMinValue:(CGFloat)minValue maxValue:(CGFloat)maxValue
  • (void)setLeftValue:(CGFloat)leftValue rightValue:(CGFloat)rightValue

Available styling properties

Images are customizable, default ones are used when no image is provided.

  • trackImage - track background image
  • rangeImage - range background image
  • leftThumbImage - left thumb image
  • rightThumbImage - right thumb image

Usage

In your View Controller

- (void)viewDidLoad {
    // ...
    self.rangeSlider = [[MARKRangeSlider alloc] initWithFrame:CGRectZero];
    [self.rangeSlider addTarget:self
                         action:@selector(rangeSliderValueDidChange:)
               forControlEvents:UIControlEventValueChanged];

    [self.rangeSlider setMinValue:0.0 maxValue:1.0];
    [self.rangeSlider setLeftValue:0.2 rightValue:0.7];

    self.rangeSlider.minimumDistance = 0.2;

    [self.view addSubview:self.rangeSlider];
    // ...
}

- (void)rangeSliderValueDidChange:(MARKRangeSlider *)slider {
    NSLog(@"%0.2f - %0.2f", slider.leftValue, slider.rightValue);
}

Installation

MARKRangeSlider is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'MARKRangeSlider'

Author

Vadym Markov, [email protected]

License

MARKRangeSlider is available under the MIT license. See the LICENSE file for more info.

markrangeslider's People

Contributors

vadymmarkov avatar arrnas avatar ansonyao avatar ashfurrow avatar bryanleezigbang avatar ikovalisko avatar vvit avatar xuaninbox avatar yeonmee avatar

Watchers

James Cloos 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.