[翻译] KYCircularProgress

时间:2023-03-10 06:40:20
[翻译] KYCircularProgress

KYCircularProgress

[翻译] KYCircularProgress

Flexible progress bar written in Swift.

用Swift语言编写的灵活的进度条控件。

Features

  • Gradation Color 渐变的颜色
  • Progress Closure 进度渐变
  • UIBezierPath Progress Bar 支持贝塞尔曲线

Demo

[翻译] KYCircularProgress

Requirement

  • iOS7.0+
  • Xcode6.0.1+

Usage 使用

Create KYCircularProgress 创建KYCircularProgress

var circularProgress: KYCircularProgress! = KYCircularProgress(frame: self.view.bounds)

Gradation Color 渐变的颜色

// support Hex color to RGB color
circularProgress.colors = [0xA6E39D, 0xAEC1E3, 0xE1A5CB, 0xF3C0AB]

Progress Closure 实时进度

circularProgress.progressChangedClosure({ (progress: Double, circularView: KYCircularProgress) in
println("progress: \(progress)")
})

UIBezierPath Progress Bar 贝塞尔曲线的bar

// create "Star progress bar"
let path = UIBezierPath()
path.moveToPoint(CGPointMake(50.0, 2.0))
path.addLineToPoint(CGPointMake(84.0, 86.0))
path.addLineToPoint(CGPointMake(6.0, 33.0))
path.addLineToPoint(CGPointMake(96.0, 33.0))
path.addLineToPoint(CGPointMake(17.0, 86.0))
path.closePath()
circularProgress.path = path

Installation 安装

  1. Add KYCircularProgress.swift in your project. 将KYCircularProgress.swift添加到你的项目当中即可