Coder Social home page Coder Social logo

vprangeslider's Introduction

VPRangeSlider

This is a 2 way slider for iOS. You can create segmented or unsegmented range sliders. Similar to price range selector seen in different apps/websites. You can customize the views as per your requirements.

Installation

Drag and drop the VPRangeSlider.h and VPRangeSlider.m into project file

Requirements

  1. iOS 7.0 or later.
  2. ARC memory management.

Usage

After adding VPRangeSlider.h and VPRangeSlider.m files into your project, there are 2 ways to create slider.

  1. By adding an empty view to your xib/storyboard and changing the class of the view to VPRangeSlider. After adding the view create an outlet.

  2. Programmatically set the property for the view.

For the oulet/property of the view set the necessary properties. If more customization is needed, you can set the optional parameters.

If the requiresSegments is set to YES, then segmented range slider is created. Else normal slider is created.

There are 2 public functions.

  • (void)scrollStartSliderToStartRange:(CGFloat)startRange andEndRange:(CGFloat)endRange;
  • (void)scrollStartSliderToIndex:(NSInteger)startIndex andEndIndex:(NSInteger)endIndex;

The first method should only be used for smooth slider specifying the start and end range in percentages. The second method should only be used for segmented slider specifying the start and end index (1 - numberOfSegments).

If needed, then you can make use of 2 delegates.

  • (void)sliderScrollingWithMinPercent:(CGFloat)minPercent andMaxPercent:(CGFloat)maxPercent

This delegate is called every time the slider is moved/panned until the sliding stops.

  • (void)sliderScrolledToMinIndex:(NSInteger)minIndex andMaxIndex:(NSInteger)maxIndex This delegate is called when the slider stops at any segmented index.

Screenshot

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

###Version 1.0.1

Added the intitial preset value for slider to display the default value during initilization. Some minor bug fixes.

###Version 1.0.0

Stable range slider for segmented and unsegemented view with necessart code cleaning and bug fixes.

###Version 0.1.0

Basic slider with all the necessary functions like 2 way slider with/without segments and properties for handling different views and colors.

License

The MIT License (MIT)

Copyright (c) 2015 Varun P M

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

vprangeslider's People

Contributors

varun-pm avatar varunpm1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vprangeslider's Issues

scrollStartSliderToStartRange:andEndRange: does not layout the range slider

Hello, I'm currently using the scrollStartSliderToStartRange:andEndRange: code to attempt and "reset" the range slider, but the range slider doesn't seem to go scroll back.

I currently have a button to reset the range slider's positions, when I run it in debug mode, it sets the min and max range to 0 and 100 respectively, but doesn't seem to reload the view of the range slider back to 0 and 100

The line of code I'm using currently looks like this:
- (IBAction)onResetRangeBtnTouched:(id)sender { [self.rangeSlider scrollStartSliderToRange:0 andEndRange:100]; }

Slider Thumb Overlaps

Hello Sir,

Can we Overlaps both the thumbs at same position or value.

i have time Slider with 00 to 24 value, i need to min and max value overlaps like 24:00 to 24:00.

Thanks in advance.

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.