欢迎光临
我们一直在努力

NumberChange

建站超值云服务器,限时71元/月

NumberChange

项目介绍:

NumberChange  

数字动态变化

整数样式数字的变化:

[Objective-C] 查看源文件 复制代码

UICountingLabel *myLabel = [[UICountingLabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.label1.frame) +20, WIDTH, 45)];
myLabel.textAlignment = NSTextAlignmentCenter;
myLabel.font = [UIFont fontWithName:@"Avenir Next" size:48];
myLabel.textColor = [UIColor colorWithRed:236/255.0 green:66/255.0 blue:43/255.0 alpha:1];
[self.view addSubview:myLabel];
//设置格式
myLabel.format = @"%d";
//设置变化范围及动画时间
[myLabel countFrom:0 to:100 withDuration:2.0f];


浮点数样式数字的变化:

[Objective-C] 查看源文件 复制代码

UICountingLabel *myLabel = [[UICountingLabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.label2.frame) +20, WIDTH, 45)];
myLabel.textAlignment = NSTextAlignmentCenter;
myLabel.font = [UIFont fontWithName:@"Avenir Next" size:48];
myLabel.textColor = [UIColor colorWithRed:236/255.0 green:66/255.0 blue:43/255.0 alpha:1];
[self.view addSubview:myLabel];
//设置格式
myLabel.format = @"%.2f";
//设置变化范围及动画时间
[myLabel countFrom:0.0 to:3198.23 withDuration:2.0f];


带有千分位分隔符的浮点数样式:

[Objective-C] 查看源文件 复制代码

UICountingLabel *myLabel = [[UICountingLabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.label3.frame) +20, WIDTH, 45)];
myLabel.textAlignment = NSTextAlignmentCenter;
myLabel.font = [UIFont fontWithName:@"Avenir Next" size:48];
myLabel.textColor = [UIColor colorWithRed:236/255.0 green:66/255.0 blue:43/255.0 alpha:1];
[self.view addSubview:myLabel];
//设置格式
myLabel.format = @"%.2f";
//设置分隔符样式
myLabel.floatingPositiveFormat = @"###,##0.00";
//设置变化范围及动画时间
[myLabel countFrom:0.00 to:3048.64   withDuration:2.0f];

https://github.com/zhaoquntao/NumberChange

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » NumberChange
分享到: 更多 (0)