SSCircularSlider
一个简单且强大的圆形环形滑动器,用 Swift 编写并能完全自定义。
特点!
- 圆形环形滑动器
- 可自定义滑动器颜色
- 可自定义滑动器旋钮
- 可自定义滑动器端点按钮
- 通过编辑中心标签调整滑动器
- 滑动器动态值
- CocoaPods
要求
- iOS 10.0+
- Xcode 9+
安装
CocoaPods
-
您可以通过将 SSSpinnerButton 添加到 Podfile 中来使用 CocoaPods 安装
use_frameworks! pod 'SSCircularSlider'
-
import UIKit import SSCircularSlider
手动
- 下载并将 SSCircularSlider 文件夹拖放到您的项目。
- 恭喜,您已完成安装!
使用示例
-
在故事板中添加一个UIView,并将其类更改为SSCircularSlider
设置值
let arrValues: [Int] = [Int](0...30) circularRingSlider.setArrayValues(labelValues: arrValues, currentIndex: indexOfValue)
设置初始值
let arrValues: [Int] = [Int](0...30) indexOfValue = 0 circularRingSlider.setValues(initialValue: arrValues[indexOfValue].toCGFloat(), minValue: arrValues[0].toCGFloat(), maxValue: arrValues[arrValues.count-1].toCGFloat())
设置旋钮图片
circularRingSlider.setKnobOfSlider(knobSize: 40, knonbImage: UIImage(named: "iconKnobRed")!)
设置文本字段代理
circularRingSlider.setValueTextFieldDelegate(viewController: self)
设置环形宽度
circularRingSlider.setCircularRingWidth(innerRingWidth: 18, outerRingWidth: 18)
设置所有按钮的背景颜色
circularRingSlider.setBackgroundColorOfAllButtons(startPointColor: UIColor.red, endPointColor: UIColor.lightGray, knobColor: UIColor.white)
设置端点图片
circularRingSlider.setEndPointsImage(startPointImage: iconMinus, endPointImage: iconPlus)
设置进度图层颜色(渐变颜色)
circularRingSlider.setProgressLayerColor(colors: [UIColor.red.cgColor, UIColor.red.cgColor])
设置环形滑块代理
extension ViewController: SSCircularRingSliderDelegate { func controlValueUpdated(value: Int) { print("current control value:\(value)") // Your code here } }
贡献
- 我们非常欢迎对SSCircularSlider的贡献,请查看LICENSE文件获取更多信息。
元信息
- 根据MIT许可证分发。查看LICENSE获取更多信息。