实现效果
代码实现
1、定义类,继承UILabel
#import <UIKit/UIKit.h>
@interface AnimationLabel : UILabel
@property (nonatomic, assign) NSTimeInterval duration;
/**
动画数字改变
@param fromValue 开始数值
@param toValue 结束数值
@param duration 动画时间
@param complete 完成回调
*/
- (void)animationTextStartValue:(CGFloat)fromValue endValue:(CGFloat)toValue duration:(CGFloat)duration complete:(void (^)(UILabel *label, CGFloat value))complete;
@end
#import "AnimationLabel.h"
@interface AnimationLabel ()
@property (nonatomic, strong) CADisplayLink *playLink;
@property (nonatomic, assign) NSInteger displayPerSecond;
@property (nonatomic, assign) CGFloat valueStart;
@property (nonatomic, assign) CGFloat valueEnd;
@property (nonatomic, assign) CGFloat valueLast;
@property (n