LinearProgressBar
LinearProgressBar是一个简单的iOS进度指示器控件。
用法
要运行示例项目,克隆存储库,并运行示例Xcode项目。
设置非常简单
1. Create a UIView in Storyboard.
2. Set the custom class to LinearProgressView
自定义
使用以下参数自定义进度条
- barColor: 进度条的颜色
- trackColor: 进度条基底层(track)的颜色
- barThickness: 控制进度条的宽度
动态颜色
通过提供闭包来根据progressValue调整进度条颜色。默认为Storyboard/IB中设置的颜色。
示例
linearProgressView.barColorForValue = { value in
switch value {
case 0..<20:
return UIColor.redColor()
case 20..<60:
return UIColor.orangeColor()
case 60..<80:
return UIColor.yellowColor()
default:
return UIColor.greenColor()
}
}
安装
LinearProgressBar 可通过 CocoaPods 获取。要安装它,只需将以下行添加到 Podfile 中
pod "LinearProgressBar"
作者
Eliel Gordon, [email protected]
许可
LinearProgressBar 采用 MIT 许可。更多信息请参阅 LICENSE 文件。