A simple, powerful and fully customizable circular slider, written in swift.
A simple and powerful circular ring slider, written in swift and fully customizable.
CocoaPods
You can use CocoaPods to install SSSpinnerButton by adding it to your Podfile:
use_frameworks!
pod 'SSCircularSlider'
import UIKit
import SSCircularSlider
Manually
In the storyboard add a UIView and change its class to SSCircularSlider
SetValues
let arrValues: [Int] = [Int](0...30)
circularRingSlider.setArrayValues(labelValues: arrValues, currentIndex: indexOfValue)
SetInitialValue
let arrValues: [Int] = [Int](0...30)
indexOfValue = 0
circularRingSlider.setValues(initialValue: arrValues[indexOfValue].toCGFloat(), minValue: arrValues[0].toCGFloat(), maxValue: arrValues[arrValues.count-1].toCGFloat())
SetKnobImage
circularRingSlider.setKnobOfSlider(knobSize: 40, knonbImage: UIImage(named: "iconKnobRed")!)
SetTextFieldDelegate
circularRingSlider.setValueTextFieldDelegate(viewController: self)
SetRingWidth
circularRingSlider.setCircularRingWidth(innerRingWidth: 18, outerRingWidth: 18)
SetBackgroundColorOfAllButtons
circularRingSlider.setBackgroundColorOfAllButtons(startPointColor: UIColor.red, endPointColor: UIColor.lightGray, knobColor: UIColor.white)
SetEndPointImages
circularRingSlider.setEndPointsImage(startPointImage: iconMinus, endPointImage: iconPlus)
SetProgressLayerColor(Gradient Colors)
circularRingSlider.setProgressLayerColor(colors: [UIColor.red.cgColor, UIColor.red.cgColor])
SetCircularSliderDelegate
extension ViewController: SSCircularRingSliderDelegate {
func controlValueUpdated(value: Int) {
print("current control value:\(value)")
// Your code here
}
}