CHCountingLabel 不仅具有基本计数的功能。
它还可以加快或减慢计数速度。
使用 CHCountingLabel 为您的应用程序带来更多精彩效果。
CHCountingLabel 非常易于使用。
@IBOutlet weak var countingLabel: CountingLabel!
override func viewDidLoad() {
super.viewDidLoad()
countingLabel.textFormatter = { (value: Double) -> String in
return "\(Int(value))"
}
countingLabel.startValue = 50
// Default stop value is 0.
// coutingLabel.stopValue = 0
}
@IBAction func startCountingButtonClicked(_: AnyObject) {
countingLabel.start()
}
@IBAction func pauseCountingButtonClicked(_: AnyObject) {
countingLabel.pause()
}
@IBAction func stopCoutingButtonClicked(_: AnyObject) {
countingLabel.stop()
}
countingLabel.startValue = 0
countingLabel.stopValue = 50
countingLabel.easing = CubicBezier.Easing.EaseInOut
countingLabel.duration = 5
countingLabel.startValue = 50
// countingLabel.stopValue = 100
根据 ,您需要在 Objective-C 代码中更新导入语句(到 #import "ProductModuleName-Swift.h")。
#import "CHCountingLabel-Swift.h"
// or
@import "CHCountingLabel.h"
完成!开始使用 CHCountingLabel!
版权所有 © Calvin Huang。本软件受 MIT 许可证许可。