android 数字加减动画,GitHub - ElvisCen/PPCounter: 一款简单实用的数字加减动画,支持UILabel、UIButton显示...

PPCounter

一款简单实用的数字加减动画,支持UILabel、UIButton显示

PPCounter.gif

##Requirements 要求

iOS 7+

Xcode 8+

##Installation 安装

###1.手动安装:

下载DEMO后,将子文件夹PPCounter拖入到项目中, 导入头文件UILabel+PPCounter.h或UIButton+PPCounter.h开始使用

###2.CocoaPods安装:

first

pod 'PPCounter',:git => 'https://github.com/jkpang/PPCounter.git'

then

pod install或pod install --no-repo-update

如果发现pod search PPCounter 不是最新版本,在终端执行pod setup命令更新本地spec镜像缓存(时间可能有点长),重新搜索就OK了

##Usage 使用方法

###1. UILabel

####1.1 设置一般字体属性UILabel

....

[label pp_fromNumber:0 toNumber:100 duration:1.5 animationType:PPCounterAnimationTypeEaseOut formatBlock:^NSString *(CGFloat number) {

// 此处自由拼接内容

return [NSString stringWithFormat:@"%.2f",number];

} completeBlock:^{

// 完成的回调

}];

####1.2 设置富文本字体属性UILabel

....

[label pp_fromNumber:0 toNumber:100 duration:1.5 animationType:PPCounterAnimationTypeEaseOut attributedFormatBlock:^NSAttributedString *(CGFloat number) {

// 此处自由设置富文本属性的内容

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@""];

return attributedString;

} completeBlock:^{

// 完成的回调

}];

###2. UIButton

####1.1 设置一般字体属性UIButton

....

[button pp_fromNumber:0 toNumber:100 duration:1.5 animationType:PPCounterAnimationTypeEaseOut formatBlock:^NSString *(CGFloat number) {

// 此处自由拼接内容

return [NSString stringWithFormat:@"%.2f",number];

} completeBlock:^{

// 完成的回调

}];

####1.2 设置富文本字体属性UIButton

....

[button pp_fromNumber:0 toNumber:100 duration:1.5 animationType:PPCounterAnimationTypeEaseOut attributedFormatBlock:^NSAttributedString *(CGFloat number) {

// 此处自由设置富文本属性的内容

NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:@""];

return attributedString;

} completeBlock:^{

// 完成的回调

}];

以上就是PPCounter的简单使用方法,更详细的用法请看demo

###你的star是我持续更新的动力!

##CocoaPods更新日志

2016.10.19(tag:0.1.0)--初始化到CocoaPods;

##联系方式:

Weibo : @CoderPang

QQ : 2406552315

##许可证

PPCounter 使用 MIT 许可证,详情见 LICENSE 文件。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值