Kevin

Merge pull request #28 from Lewuathe/update-circlechart

Continuous updating of PNCircleChart
@@ -9,6 +9,12 @@ @@ -9,6 +9,12 @@
9 #import "PNCircleChart.h" 9 #import "PNCircleChart.h"
10 #import "UICountingLabel.h" 10 #import "UICountingLabel.h"
11 11
  12 +@interface PNCircleChart () {
  13 + UICountingLabel *_gradeLabel;
  14 +}
  15 +
  16 +@end
  17 +
12 @implementation PNCircleChart 18 @implementation PNCircleChart
13 19
14 20
@@ -43,6 +49,8 @@ @@ -43,6 +49,8 @@
43 [self.layer addSublayer:_circle]; 49 [self.layer addSublayer:_circle];
44 [self.layer addSublayer:_circleBG]; 50 [self.layer addSublayer:_circleBG];
45 51
  52 + _gradeLabel = [[UICountingLabel alloc] initWithFrame:CGRectMake(0, 0, 50.0, 50.0)];
  53 +
46 } 54 }
47 55
48 return self; 56 return self;
@@ -53,16 +61,15 @@ @@ -53,16 +61,15 @@
53 { 61 {
54 //Add count label 62 //Add count label
55 63
56 - UICountingLabel *gradeLabel = [[UICountingLabel alloc] initWithFrame:CGRectMake(0, 0, 50.0, 50.0)]; 64 + [_gradeLabel setTextAlignment:NSTextAlignmentCenter];
57 - [gradeLabel setTextAlignment:NSTextAlignmentCenter]; 65 + [_gradeLabel setFont:[UIFont boldSystemFontOfSize:13.0f]];
58 - [gradeLabel setFont:[UIFont boldSystemFontOfSize:13.0f]]; 66 + [_gradeLabel setTextColor: PNDeepGrey];
59 - [gradeLabel setTextColor: PNDeepGrey]; 67 + [_gradeLabel setCenter:CGPointMake(self.center.x,self.center.y)];
60 - [gradeLabel setCenter:CGPointMake(self.center.x,self.center.y)]; 68 + _gradeLabel.method = UILabelCountingMethodEaseInOut;
61 - gradeLabel.method = UILabelCountingMethodEaseInOut; 69 + _gradeLabel.format = @"%d%%";
62 - gradeLabel.format = @"%d%%";  
63 70
64 71
65 - [self addSubview:gradeLabel]; 72 + [self addSubview:_gradeLabel];
66 73
67 //Add circle params 74 //Add circle params
68 75
@@ -80,7 +87,7 @@ @@ -80,7 +87,7 @@
80 [_circle addAnimation:pathAnimation forKey:@"strokeEndAnimation"]; 87 [_circle addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
81 _circle.strokeEnd = [_current floatValue]/[_total floatValue]; 88 _circle.strokeEnd = [_current floatValue]/[_total floatValue];
82 89
83 - [gradeLabel countFrom:0 to:[_current floatValue]/[_total floatValue]*100 withDuration:1.0]; 90 + [_gradeLabel countFrom:0 to:[_current floatValue]/[_total floatValue]*100 withDuration:1.0];
84 91
85 } 92 }
86 93