Coder Social home page Coder Social logo

rangesliderview's Introduction

RangeSliderView

CI Status Version License Platform



RangeSliderView is a NSControl/UIControl subclass that provides an easy control to select a range.

Features

  • Cross platform; works on the iOS and MacOSX.
  • Customisable Knob and Progress colors.
  • @IBDesignable and @IBInspectable

Installation

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

pod "RangeSliderView"

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Using Interface builder

You can add RangeSliderView in your view using Interface builder by dragging a view and set RangeSliderView as the custom view class.

You can add an action using normal target action.

RangeSliderView contain inspectable properties, to change it's properties, edit the inspectable values in Interface Builder.

Inspectable

Using code

Create a RangeSliderView and add it as a subview

let rangeSliderView = RangeSliderView(frame: CGRect(x: 10, y: 10, width: 200, height: 50))
self.view.addSubview(rangeSliderView)

To add actions, you can either use Target/Action or blocks. To use target/action:

On Mac

rangeSliderView.target = self
rangeSliderView.action = "valueChanged:"

On iOS

rangeSliderView.addTarget(self, action: "valueChanged:", forControlEvents: .ValueChanged)

For block action callbacks use the following

rangeSliderView.selectedValuesChanged = { min, max in
}

Customisation

The following are customisable properties of the RangeSliderView:

sliderKnobColor Sets the Knob background color (Defaults to white)

sliderKnobHighligtedColor Sets the Knob highlight color (Defaults to light grey)

sliderKnobBorderColor Sets the Knob border color (Defaults to grey)

sliderProgressFilledColor Sets the slider progress filled color (Defaults to blue)

sliderProgressEmptyColor Sets the slider progress empty color (Defaults to grey)

screenshots

Mac:

Normal colors Fancy colors

iOS:

Normal colors Fancy colors

Author

Omar Abdelhafith, [email protected]

License

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

rangesliderview's People

Contributors

nsomar avatar

Stargazers

 avatar 尚光泉 avatar  avatar Erhies Fekarurhobo avatar Igor Zubkov avatar MohsinAli avatar Kirill Kunst avatar Greg Cotten avatar 小王子 avatar Tiago Braga avatar Dongjin Suh avatar Andrei Radulescu avatar diatoming avatar Jared avatar Ronan McHugh avatar Steven Diviney avatar Martin Høst Normark avatar  avatar

Watchers

James Cloos avatar MohsinAli avatar  avatar  avatar

rangesliderview's Issues

Can I change?

Now value of left knob begins at the left side and value of right knob begins on the right side.
How can I change it to be: value of left knob begins at the right side and value of right knob begins on the left side?

Sliding is not smooth - Use in UITableViewCell

When you slide a knob and your finger does not slide perfectly horizontally, knob stops sliding.

I use slider inside a UITableViewCell subclass (not tested it in a simple view). Table view starts to scroll vertically and knob stops sliding. Maybe you need to disable superviews scrolling.

I tested the Apple slider under iPhone settings to change screen brightness and I noticed Apple is disabling vertical scroll of the settings grouped table view when brightness slider is scrolling (horizontally).

It would be nice to have this issue fixed because it is a really cool library (@Inspectable feature is really cool)!

Thanks!

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.