PNCircleChart.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. //
  2. // PNCircleChart.h
  3. // PNChartDemo
  4. //
  5. // Created by kevinzhow on 13-11-30.
  6. // Copyright (c) 2013年 kevinzhow. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import "UICountingLabel.h"
  10. typedef NS_ENUM (NSUInteger, PNChartFormatType) {
  11. PNChartFormatTypePercent,
  12. PNChartFormatTypeDollar,
  13. PNChartFormatTypeNone,
  14. PNChartFormatTypeDecimal,
  15. PNChartFormatTypeDecimalTwoPlaces,
  16. };
  17. #define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI)
  18. @interface PNCircleChart : UIView
  19. - (void)strokeChart;
  20. - (void)growChartByAmount:(NSNumber *)growAmount;
  21. - (void)updateChartByCurrent:(NSNumber *)current;
  22. - (void)updateChartByCurrent:(NSNumber *)current byTotal:(NSNumber *)total;
  23. //- (id)initWithFrame:(CGRect)frame
  24. // total:(NSNumber *)total
  25. // current:(NSNumber *)current
  26. // clockwise:(BOOL)clockwise;
  27. //
  28. //- (id)initWithFrame:(CGRect)frame
  29. // total:(NSNumber *)total
  30. // current:(NSNumber *)current
  31. // clockwise:(BOOL)clockwise
  32. // shadow:(BOOL)hasBackgroundShadow
  33. // shadowColor:(UIColor *)backgroundShadowColor;
  34. //
  35. //- (id)initWithFrame:(CGRect)frame
  36. // total:(NSNumber *)total
  37. // current:(NSNumber *)current
  38. // clockwise:(BOOL)clockwise
  39. // shadow:(BOOL)hasBackgroundShadow
  40. // shadowColor:(UIColor *)backgroundShadowColor
  41. //displayCountingLabel:(BOOL)displayCountingLabel;
  42. - (id)initWithFrame:(CGRect)frame
  43. total:(NSNumber *)total
  44. current:(NSNumber *)current
  45. clockwise:(BOOL)clockwise
  46. shadow:(BOOL)hasBackgroundShadow
  47. shadowColor:(UIColor *)backgroundShadowColor
  48. displayCountingLabel:(BOOL)displayCountingLabel
  49. overrideLineWidth:(NSNumber *)overrideLineWidth
  50. strokeColor:(UIColor *)strokeColor;
  51. @property (strong, nonatomic) UICountingLabel *countingLabel;
  52. @property (nonatomic) UIColor *strokeColor;
  53. @property (nonatomic) UIColor *strokeColorGradientStart;
  54. @property (nonatomic) NSNumber *total;
  55. @property (nonatomic) NSNumber *current;
  56. @property (nonatomic) NSNumber *lineWidth;
  57. @property (nonatomic) NSTimeInterval duration;
  58. @property (nonatomic) PNChartFormatType chartType;
  59. @property (nonatomic) CAShapeLayer *circle;
  60. @property (nonatomic) CAShapeLayer *gradientMask;
  61. @property (nonatomic) CAShapeLayer *circleBackground;
  62. @property (nonatomic) BOOL displayCountingLabel;
  63. @property (nonatomic) BOOL displayAnimated;
  64. @end