悟空记账

UICountingLabel.h 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #import <Foundation/Foundation.h>
  2. #import <UIKit/UIKit.h>
  3. typedef enum {
  4. UILabelCountingMethodEaseInOut,
  5. UILabelCountingMethodEaseIn,
  6. UILabelCountingMethodEaseOut,
  7. UILabelCountingMethodLinear
  8. } UILabelCountingMethod;
  9. typedef NSString* (^UICountingLabelFormatBlock)(float value);
  10. typedef NSAttributedString* (^UICountingLabelAttributedFormatBlock)(float value);
  11. @interface UICountingLabel : UILabel
  12. @property (nonatomic, strong) NSString *format;
  13. @property (nonatomic, assign) UILabelCountingMethod method;
  14. @property (nonatomic, assign) NSTimeInterval animationDuration;
  15. @property (nonatomic, copy) UICountingLabelFormatBlock formatBlock;
  16. @property (nonatomic, copy) UICountingLabelAttributedFormatBlock attributedFormatBlock;
  17. @property (nonatomic, copy) void (^completionBlock)();
  18. -(void)countFrom:(float)startValue to:(float)endValue;
  19. -(void)countFrom:(float)startValue to:(float)endValue withDuration:(NSTimeInterval)duration;
  20. -(void)countFromCurrentValueTo:(float)endValue;
  21. -(void)countFromCurrentValueTo:(float)endValue withDuration:(NSTimeInterval)duration;
  22. -(void)countFromZeroTo:(float)endValue;
  23. -(void)countFromZeroTo:(float)endValue withDuration:(NSTimeInterval)duration;
  24. - (CGFloat)currentValue;
  25. @end