Skip to content
Explain how to acceleration and deceleration countdown speed according bezier path.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CHCountingLabel.xcodeproj
CHCountingLabel.xcworkspace
CHCountingLabel
Pods
assets
.gitignore
.travis.yml
CHCountingLabel.podspec
LICENSE
Podfile
Podfile.lock
README.md

README.md

CHCountingLabel

swift-version platforms pod

Snapshot

snapshot1

snapshot2

About

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.

Usage

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

Install

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

Migrate to Objective-C project

Accorading Apple's document, 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!

License

Copyright (c) Calvin Huang. This software is licensed under the MIT License.

You can’t perform that action at this time.