VHProgressBar

VHProgressBar 是一个垂直和水平方向的动画进度条。

progressTest1 progressTest2

安装

Cocoapods

将以下代码添加到你的 Podfile

pod 'VHProgressBar', '~> 1.0'

安装到你的项目中

$ pod install

使用

通过 Swift 代码

//import UIKit and VHProgressBar
import UIKit
import VHProgressBar

 // vertical progress bar
let verticalProgressBar = VerticalProgressBar()
// horizontal progress bar
let horizontalProgressBar = HorizontalProgressBar()

self.view.addSubview(verticalProgressBar)
self.view.addSubview(horizontalProgressBar)

//adjust layout
verticalProgressBar.pgHeight = 350
verticalProgressBar.pgWidth = 35
verticalProgressBar.frameBold = 0.5

horizontalProgressBar.pgHeight = 50
horizontalProgressBar.pgWidth = 500
horizontalProgressBar.frameBold = 1.0

// start simple animation
verticalProgressBar.animateProgress(duration: 2.0, progressValue: 0.7)
horizontalProgressBar.animateProgress(duration: 3.0, progressValue: 0.2)

// start repeat animation
// you can choose type "normal" or "reverse"
verticalProgressBar.startAnimation(type: "normal", duration: 3.0)
//stop repeat animation  
verticalProgressBar.stopAnimation()

通过 Storyboard

在你的 Storyboard 的 viewController 中拖入一个 UIView,并将 class 设置为 VerticalProgressBarHorizontalProgressBar

storyboard1

通过 Interface Builder 设置属性来自定义你的进度条。

storyboard2

支持的属性

属性 描述
背景颜色 进度条背景颜色
Bar 颜色 进度条颜色
边框颜色 边框颜色
边框粗细 边框宽度
Pg 高度 进度条高度
Pg 宽度 进度条宽度

贡献

欢迎贡献!!

版本

1.0

作者

Sohei Miyakura(miyass)