CHCountingLabel has not only function to do basic counting.
It also can speeding up or slowing down counting.
Use CHCountingLabel to bring more awesome effect for your app.
CHCountingLabel is very simple to use.
- Basic counting - Decrease numbers per second
@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()
}
- Basic counting - Increase numbers per second
countingLabel.startValue = 0
countingLabel.stopValue = 50
- Counint seed up and slow down depends on given bezier path.
countingLabel.easing = CubicBezier.Easing.EaseInOut
countingLabel.duration = 5
countingLabel.startValue = 50
// countingLabel.stopValue = 100
Via from CocoaPods.
Add pod 'CHCountingLabel'
to your Podfile and run pod install
platform :ios, '8.0'
target 'MyApp' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod 'CHCountingLabel'
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppUITests' do
inherit! :search_paths
# Pods for testing
end
end
Accorading , you need to Update import statements in your Objective-C code (to #import "ProductModuleName-Swift.h")
.
#import "CHCountingLabel-Swift.h"
// or
@import "CHCountingLabel.h"
All done! Start to use CHCountingLabel!
Copyright (c) Calvin Huang. This software is licensed under the MIT License.