CircleSlider 0.6.0

CircleSlider 0.6.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2017年10月
SwiftSwift 版本3.0
SPM支持 SPM

shushutochako 维护。



CircleSlider




描述和 appetize.io 的 DEMO

用法

要运行示例项目,克隆仓库,然后首先从 Example 目录运行 pod install

需求

  • iOS 8.0+
  • Xcode 8.0

安装

手动安装

CircleSlider 需要的类文件位于此仓库根目录下的 Classes 文件夹中,如下列所示

CircleSlider.swift
TrackLayer.swift
Math.swift

用法

要运行示例项目,克隆仓库,然后首先从 Example 目录运行 pod install

简单

self.circleSlider = CircleSlider(frame: self.sliderArea.bounds, options: nil)
self.circleSlider?.addTarget(self, action: Selector("valueChange:"), forControlEvents: .ValueChanged)
self.sliderArea.addSubview(self.circleSlider)

自定义

let options = [
.BarColor(UIColor(red: 198/255, green: 244/255, blue: 23/255, alpha: 0.2)),
.ThumbColor(UIColor(red: 141/255, green: 185/255, blue: 204/255, alpha: 1)),
.TrackingColor(UIColor(red: 78/255, green: 136/255, blue: 185/255, alpha: 1)),
.BarWidth(20),
.StartAngle(-45),
.MaxValue(150),
.MinValue(20)
]
self.circleSlider = CircleSlider(frame: self.sliderArea.bounds, options: options)
self.circleSlider?.addTarget(self, action: Selector("valueChange:"), forControlEvents: .ValueChanged)
self.sliderArea.addSubview(self.circleSlider)

实例化后更改选项

self.circleSlider.changeOptions([.BarWidth(45)])

自定义

  • case StartAngle(Double)
  • case BarColor(UIColor)
  • case TrackingColor(UIColor)
  • case ThumbColor(UIColor)
  • case ThumbImage(UIImage)
  • case BarWidth(CGFloat)
  • case ThumbWidth(CGFloat)
  • case MaxValue(Float)
  • case MinValue(Float)
  • case SliderEnabled(Bool)
    • 如果您想用作进度条,则应该将其设置为 false

  • case ViewInset(CGFloat)
  • case MinMaxSwitchTreshold(Float)

作者

shushutochako,[email protected]

许可证

CircleSlider 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。