All Projects → EFPrefix → Efcountinglabel

EFPrefix / Efcountinglabel

Licence: mit
Adds animated counting support to UILabel.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Efcountinglabel

Ppnumberbutton
iOS中一款高度可定制性商品计数按钮(京东/淘宝/饿了么/美团外卖/百度外卖样式)
Stars: ✭ 845 (+171.7%)
Mutual labels:  cocoapods, button
Txscrolllabelview
🌭TXScrollLabelView, the best way to show & display information such as adverts / boardcast / onsale e.g. with a customView.
Stars: ✭ 714 (+129.58%)
Mutual labels:  cocoapods, label
Attributedstring
基于Swift插值方式优雅的构建富文本, 支持点击长按事件, 支持不同类型过滤, 支持自定义视图等.
Stars: ✭ 294 (-5.47%)
Mutual labels:  cocoapods, label
Cdmarkdownkit
An extensive Swift framework providing simple and customizable markdown parsing.
Stars: ✭ 158 (-49.2%)
Mutual labels:  cocoapods, label
Transitionbutton
UIButton sublass for loading and transition animation.
Stars: ✭ 1,124 (+261.41%)
Mutual labels:  cocoapods, button
Ftpopovermenu
FTPopOverMenu is a pop over menu for iOS which is maybe the easiest one to use. Supports both portrait and landscape. It can show from any UIView, any UIBarButtonItem and any CGRect.
Stars: ✭ 988 (+217.68%)
Mutual labels:  cocoapods, button
Countdownbutton
⏳A button component with a countdown function
Stars: ✭ 87 (-72.03%)
Mutual labels:  button, countdown
Sizeslidebutton
A fun Swift UIControl for picking a size
Stars: ✭ 46 (-85.21%)
Mutual labels:  cocoapods, button
Emspinnerbutton
UIButton sublcass with loading animation
Stars: ✭ 117 (-62.38%)
Mutual labels:  cocoapods, button
Examples Win32
Shows how to use Win32 controls by programming code (c++17).
Stars: ✭ 22 (-92.93%)
Mutual labels:  label, button
Web3.swift
A pure swift Ethereum Web3 library
Stars: ✭ 295 (-5.14%)
Mutual labels:  cocoapods
Anyformatkit
Simple text formatting in Swift
Stars: ✭ 296 (-4.82%)
Mutual labels:  cocoapods
Functionkit
A framework for functional types and operations designed to fit naturally into Swift.
Stars: ✭ 302 (-2.89%)
Mutual labels:  cocoapods
Wordpress Ios
WordPress for iOS - Official repository
Stars: ✭ 3,239 (+941.48%)
Mutual labels:  cocoapods
Flowhelper
帮助您迅速构建顶部Tab,比如今日头条效果,热搜、搜索记录、与ViewPager/ViewPager2搭配的工具类;
Stars: ✭ 295 (-5.14%)
Mutual labels:  label
Tpinappreceipt
Reading and Validating In App Purchase Receipt Locally.
Stars: ✭ 305 (-1.93%)
Mutual labels:  cocoapods
Netfox
A lightweight, one line setup, iOS / OSX network debugging library! 🦊
Stars: ✭ 3,188 (+925.08%)
Mutual labels:  cocoapods
Mixpanel Swift
Official iOS (Swift) Tracking Library for Mixpanel Analytics
Stars: ✭ 294 (-5.47%)
Mutual labels:  cocoapods
Ioniconskit
Use Ionicons in your Swift projects.
Stars: ✭ 310 (-0.32%)
Mutual labels:  cocoapods
Glnotificationbar
GLNotificationBar is a ios10 style notification bar, can be used to handle push notification in active state.
Stars: ✭ 306 (-1.61%)
Mutual labels:  cocoapods

A label which can show number change animated in Swift, inspired by UICountingLabel.

中文介绍

Overview

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Version Needs
1.x Xcode 8.0+
Swift 3.0+
iOS 8.0+
4.x Xcode 9.0+
Swift 4.0+
iOS 8.0+
5.x Xcode 10.0+
Swift 5.0+
iOS 8.0+

Installation

EFCountingLabel is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'EFCountingLabel'

Setup

Simply initialize a EFCountingLabel the same way you set up a regular UILabel:

let myLabel = EFCountingLabel(frame: CGRect(x: 10, y: 10, width: 200, height: 40))
self.view.addSubview(myLabel)

You can also add it to your xib or storyboard , just make sure you set the class and module to EFCountingLabel.

Use

Set the format of your label. This will be filled with string (depending on how you format it) when it updates, you can provide a formatBlock, which permits greate control over how the text is formatted. If not provided, the default format will be "%d":

myLabel.setUpdateBlock { value, label in
    label.text = String(format: "%.2f%%", value)
}

Optionally, set the timing function. The default is EFTimingFunction.linear, which will not change speed until it reaches the end. Other options are described below in the Methods section.

myLabel.counter.timingFunction = EFTimingFunction.easeOut(easingRate: 3)

When you want the label to start counting, just call:

myLabel.countFrom(5, to: 100)

You can also specify the duration. The default is 2.0 seconds.

myLabel.countFrom(1, to: 10, withDuration: 3.0)

You can use common convinient methods for counting, such as:

myLabel.countFromCurrentValueTo(100)
myLabel.countFromZeroTo(100)

Behind the scenes, these convinient methods use one base method, which has the following full signature:

myLabel.countFrom(startValue: CGFloat, to: CGFloat, withDuration: TimeInterval)

You can get current value of your label using currentValue method (works correctly in the process of animation too):

let currentValue: CGFloat = myLabel.counter.currentValue

Optionally, you can specify a completionBlock to perform an acton when the label has finished counting:

myLabel.completionBlock = { () in
    print("finish")
}

Modes

There are currently four modes of counting.

  • EFTimingFunction.linear: Counts linearly from the start to the end;
  • EFTimingFunction.easeIn: Ease In starts out slow and speeds up counting as it gets to the end, stopping suddenly at the final value;
  • EFTimingFunction.easeOut: Ease Out starts out fast and slows down as it gets to the destination value;
  • EFTimingFunction.easeInOut: Ease In/Out starts out slow, speeds up towards the middle, and then slows down as it approaches the destination. It is a nice, smooth curve that looks great, and is the default method;
  • EFTimingFunction.easeInBounce;
  • EFTimingFunction.easeOutBounce.

Apps using EFCountingLabel

Author

EyreFree, [email protected]

License

EFCountingLabel is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].