RangeSliderView
RangeSliderView copied to clipboard
RangeSliderView provide an easy to use range selection view.
RangeSliderView
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.
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:
iOS:
Author
Omar Abdelhafith, [email protected]
License
RangeSliderView is available under the MIT license. See the LICENSE file for more info.