在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:EFCountingLabel开源软件地址:https://gitee.com/eyrefree/EFCountingLabel开源软件介绍:A label which can show number change animated, in Swift. OverviewExampleTo run the example project, clone the repo, and run Requirements
InstallationEFCountingLabel is available through CocoaPods. To installit, simply add the following line to your Podfile: pod 'EFCountingLabel' SetupSimply initialize a let myLabel = EFCountingLabel(frame: CGRect(x: 10, y: 10, width: 200, height: 40))self.view.addSubview(myLabel) You can also add it to your UseSet the format of your label. This will be filled with a single int or float (depending on how you format it) when it updates: myLabel.format = "%d" Alternatively, you can provide a myLabel.formatBlock = { (value) in return "Score: " + (formatter.string(from: NSNumber(value: Int(value))) ?? "")} There is also a Optionally, set the mode. The default is myLabel.method = .easeOut 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) Additionally, there is myLabel.animationDuration = 1.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 let currentValue = myLabel.currentValue() Optionally, you can specify a myLabel.completionBlock = { () in print("finish")} FormatsWhen you set the If you're using a Because it uses the standard ModesThere are currently four modes of counting.
PSThe first version of EFCountingLabel is converted from UICountingLabel. AuthorEyreFree, [email protected] LicenseEFQRCode is available under the MIT license. See the LICENSE file for more info. |
请发表评论