一款使用 CoreAnimation 实现动画数字变动效果的库
WYCountingLabel
整个文件夹拖入您的项目中即可格式化 Label
__weak typeof(self) weakSelf = self;
WYCountingLabel plusLabel = [[WYCountingLabel alloc] initWithFrame:CGRectMake(20, 100, 100, 30)];
[self.view addSubview:plusLabel];
[plusLabel setWy_FormatBlock:^NSString *(double wy_number) {
NSString *str = [NSString stringWithFormat:@"%.2f元", wy_number];
return str;
}];
plusLabel.wy_number += 10;
从数字到数字的动画效果
WYCountingLabel plusLabel = [[WYCountingLabel alloc] initWithFrame:CGRectMake(20, 100, 100, 30)];
[self.view addSubview:plusLabel];
[plusLabel countFrom:0 to:1576 duration:2.0];
wangyansnow, [email protected]
WYCountingLabelDemo 遵循 MIT 许可证。有关更多信息,请参阅 LICENSE 文件。