{"id":18387182,"url":"https://github.com/jkpang/ppcounter","last_synced_at":"2025-10-23T16:35:03.698Z","repository":{"id":62450151,"uuid":"71368302","full_name":"jkpang/PPCounter","owner":"jkpang","description":"iOS与macOS中一款优雅的数字/金额增减动效组件","archived":false,"fork":false,"pushed_at":"2019-08-23T03:59:24.000Z","size":3893,"stargazers_count":475,"open_issues_count":2,"forks_count":64,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-30T01:06:42.270Z","etag":null,"topics":["cocoapods","ios","macos","objective-c","uibutton","uilabel","uilabel-uibutton"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jkpang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-19T14:54:29.000Z","updated_at":"2025-02-17T03:17:49.000Z","dependencies_parsed_at":"2022-11-02T01:01:31.766Z","dependency_job_id":null,"html_url":"https://github.com/jkpang/PPCounter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkpang%2FPPCounter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkpang%2FPPCounter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkpang%2FPPCounter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkpang%2FPPCounter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkpang","download_url":"https://codeload.github.com/jkpang/PPCounter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423515,"owners_count":20936626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cocoapods","ios","macos","objective-c","uibutton","uilabel","uilabel-uibutton"],"created_at":"2024-11-06T01:25:09.804Z","updated_at":"2025-10-23T16:35:03.626Z","avatar_url":"https://github.com/jkpang.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://github.com/jkpang/PPCounter/blob/master/Picture/PPCounter.png)\n\n![](https://img.shields.io/badge/platform-iOS%7CmacOS-red.svg)   ![](https://img.shields.io/badge/language-Objective--C-orange.svg) ![](https://img.shields.io/cocoapods/v/PPCounter.svg?style=flat) ![](https://img.shields.io/cocoapods/dt/PPCounter.svg) ![](https://img.shields.io/badge/license-MIT%20License-brightgreen.svg)  [![](https://img.shields.io/badge/weibo-jkpang--%E5%BA%9E-red.svg)](http://weibo.com/5743737098/profile?rightmod=1\u0026wvr=6\u0026mod=personinfo\u0026is_all=1)\n\niOS与macOS中一款优雅的数字/金额增减动效控件\n\n![iPhone](https://github.com/jkpang/PPCounter/blob/master/Picture/PPCounter.gif)\n![Mac](https://github.com/jkpang/PPCounter/blob/master/Picture/Mac.gif)\n\n* 支持iOS/macOS双平台(pods版本v0.5.0起支持)\n* 支持UILable/UIButton/自定义文本 控件的数字加减动画;\n* 支持一般文本属性以及富文本属性的字体显示;\n* 支持四种时间曲线函数动画:由慢到快再到慢、由慢到特别快、由快到慢、匀速;\n* 支持自定义的文本格式,例如:数字格式化千分位显示;\n* 支持CocoaPods导入\n\n\n### 新建 PP-iOS学习交流群 : 323408051 有关于PP系列封装的问题和iOS技术可以在此群讨论\n\n\n### [简书地址](http://www.jianshu.com/p/53b9bac43201)\n\n## Requirements 要求\n* iOS 7+\n* macOS 10.10+\n* Xcode 8+\n\n## Installation 安装\n### 1.手动安装:\n`下载DEMO后,将子文件夹PPCounter拖入到项目中, 导入头文件 PPCounter.h 开始使用`\n### 2.CocoaPods安装:\nfirst\n`pod 'PPCounter',:git =\u003e 'https://github.com/jkpang/PPCounter.git'`\n\nthen\n`pod install 或 pod install --no-repo-update`\n\n如果发现pod search PPCounter 不是最新版本，在终端执行pod setup命令更新本地spec镜像缓存(时间可能有点长),重新搜索就OK了\n## Usage 使用方法\n### 1. UILabel\n#### 1.1 设置一般字体属性UILabel\n```objc\n....\n[label pp_fromNumber:0 toNumber:100 duration:1.5 animationOptions:PPCounterAnimationOptionCurveEaseOut format:^NSString *(CGFloat number) {\n    // 此处自由拼接内容\n    return [NSString stringWithFormat:@\"%.2f\",number];\n} completion:^{\n        \n    // 完成的回调\n}];\n```\n#### 1.2 设置富文本字体属性UILabel\n\n```objc\n....\n[label pp_fromNumber:0 toNumber:100 duration:1.5 animationOptions:PPCounterAnimationOptionCurveEaseOut attributedFormat:^NSAttributedString *(CGFloat number) {\n        \n    // 此处自由设置富文本属性的内容\n    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@\"\"];\n    return attributedString;\n} completion:^{\n        \n    // 完成的回调\n}];\n\n```\n### 2. UIButton\n\n#### 2.1 设置一般字体属性UIButton\n```objc\n....\n[button pp_fromNumber:0 toNumber:100 duration:1.5 animationOptions:PPCounterAnimationOptionCurveEaseOut format:^NSString *(CGFloat number) {\n    // 此处自由拼接内容\n    return [NSString stringWithFormat:@\"%.2f\",number];\n} completion:^{\n        \n    // 完成的回调\n}];\n```\n#### 2.2 设置富文本字体属性UIButton\n\n```objc\n....\n[button pp_fromNumber:0 toNumber:100 duration:1.5 animationOptions:PPCounterAnimationOptionCurveEaseOut attributedFormat:^NSAttributedString *(CGFloat number) {\n        \n    // 此处自由设置富文本属性的内容\n    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@\"\"];\n    return attributedString;\n} completion:^{\n        \n    // 完成的回调\n}];\n\n```\n\n以上就是PPCounter的简单使用方法,更详细的用法请看demo\n### 3, macOS Platform 使用\n\n```objc\n[[PPCounterEngine counterEngine] fromNumber:0\n                                   toNumber:999\n                                   duration:2.f\n                          animationOptions:PPCounterAnimationOptionCurveEaseOut\n                              currentNumber:^(CGFloat number) {\n        // lable控件\n        self.numberLabel.stringValue = [NSString stringWithFormat:@\"%ld\",(NSInteger)number];\n    } completion:^{\n    \t\t// 计数完成的回调\n        self.numberLabel.textColor = [NSColor redColor];\n    }];\n```\n### 你的star是我持续更新的动力!\n===\n## CocoaPods更新日志\n* 2017.03.07(tag:0.6.0)--Mac下的定时器由 NSTimer --\u003e dispatch_source_t;\n* 2017.03.07(tag:0.5.0)--支持iOS/MacOS双平台;\n* 2017.01.07(tag:0.2.0)--优化代码命名规范;\n* 2016.10.23(tag:0.1.1)--优化代码结构与调用API方法;\n* 2016.10.19(tag:0.1.0)--初始化到CocoaPods;\n\n## 我的App \u003c-\u003e My APP\n- [PPHub](https://github.com/PPHubApp/PPHub-Feedback)：一个简洁漂亮的 GitHub iOS客户端 \u003c-\u003e A simple and beautiful GitHub iOS client   \n[![App_Store](https://github.com/jkpang/PPHub-Feedback/blob/master/Resource/Download_on_the_App_Store_135x40.svg)](https://itunes.apple.com/cn/app/PPHub%20For%20GitHub/id1314212521?mt=8)\n\n## 联系方式:\n* Weibo : [@jkpang-庞](http://weibo.com/5743737098/profile?rightmod=1\u0026wvr=6\u0026mod=personinfo\u0026is_all=1)\n* Email : jkpang@outlook.com\n* QQ群 : 323408051\n\n![PP-iOS学习交流群群二维码](https://github.com/jkpang/PPCounter/blob/master/PP-iOS%E5%AD%A6%E4%B9%A0%E4%BA%A4%E6%B5%81%E7%BE%A4%E7%BE%A4%E4%BA%8C%E7%BB%B4%E7%A0%81.png)\n\n## 许可证\nPPCounter 使用 MIT 许可证，详情见 LICENSE 文件。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkpang%2Fppcounter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkpang%2Fppcounter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkpang%2Fppcounter/lists"}