CircularMeterView 1.1

CircularMeterView 1.1

ThinhLe 维护。



  • ThinhLe

CircularMeterView

具有平滑动画的环形仪表视图

License CocoaPods Compatible Platform PRs Welcome

Demo

特性

  • 在动画过程中更新值
  • 显示一个可动画的圆形仪表视图
  • 在Storyboard/xibs中直接配置或编程初始化

要求

  • iOS 11.1+
  • Swift 5.0

安装

CocoaPods

您可以使用 CocoaPods 通过将 CircularMeterView 添加到您的 Podfile 来安装它

pod 'CircularMeterView', '1.1'

要获得完整的益处,请在外部导入UIKit的任何地方导入 CircularMeterView

import UIKit
import CircularMeterView

手动

  1. 下载并拖放 CircularMeterView.swift 到您的项目中。
  2. 恭喜您!

用法示例

  1. CircularMeterView 导入到您的项目中
import CircularMeterView
  1. 创建并配置加载按钮
let frame = CGRect(x: 50, y: 50, width: 200, height: 200)
let circularMeterView = CircularMeterView(frame: frame)

// Setting animation duration which is used on each update
circularMeterView.animationDuration = 2

// Setting animation style
circularMeterView.animationStyle = .easeIn

// Setting line cap
circularMeterView.lineCap = .square

// setting max value
circularMeterView.maxValue = 100

// setting start angle, default 0
circularMeterView.startAngle = 0

// setting end angle, default 360
circularMeterView.endAngle = 180

// Setting lower circle width, default 8
circularMeterView.lowerCircleWidth = 10

// Setting lower circle color, default gray
circularMeterView.lowerColor = .darkGray

// Setting upper circle width, default 10
circularMeterView.upperCircleWidth = 12

// Setting lower circle color, default green
circularMeterView.upperColor = .yellow

// Setting shadow radius, default 0
circularMeterView.radiusShadow = 10
circularMeterView.offsetShadow = .zero
circularMeterView.colorShadow = .black

// Add meter view as subview
view.addSubview(circularMeterView)

或者,您可以将 UIView 拖放到 storyboard/xib 文件中,并将其类设置为 CircularMeterView,然后直接在 storyboard 中配置视图。

Using Storyboard

  1. 更新值
circularMeterView.updateValue(50)

贡献

我们非常欢迎为 CircularMeterView 做出贡献,更多详情请查看 LICENSE 文件。

信息

版权所有 © 2020 Thinh Le – @Facebook

遵照 MIT 许可证分发。有关更多信息,请参阅 LICENSE 文件。

https://github.com/LThinh/CircularMeterView