GDGauge - 可定制的仪表盘视图
易于使用,高度可定制。
要求
- Xcode 11+
- Swift 5
- iOS 9+
安装
CocoaPods
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'GDGauge'
end
pod update
pod install
使用
import GDGauge
创建 GDGaugeView 实例
var gaugeView: GDGaugeView = GDGaugeView(frame: view.bounds)
设置、自定义和构建视图
gaugeView
.setupGuage(startDegree: CGFloat,
endDegree: CGFloat,
sectionGap: CGFloat,
minValue: CGFloat,
maxValue: CGFloat)
.setupContainer(width: CGFloat,
color: UIColor,
handleColor: UIColor,
shouldShowContainerBorder: Bool,
shouldShowFullCircle: Bool,
indicatorsColor: UIColor,
indicatorsValuesColor: UIColor,
indicatorsFont: UIFont)
.setupUnitTitle(title: String,
font: UIFont)
.buildGauge()
其他方法
更新句柄值
gaugeView.updateValueTo(CGFloat)
更新达到限制时的颜色
gaugeView.updateColors(containerColor: UIColor,
indicatorsColor: UIColor)
重置到初始颜色
gaugeView.resetColors()
许可
GDGauge可在MIT许可下获得。有关更多信息,请参阅LICENSE.txt文件。