Kevin

Merge pull request #14 from thefotes/master

Minor formatting changes, and fixed dead store
... ... @@ -16,14 +16,14 @@
self = [super initWithFrame:frame];
if (self) {
// Initialization code
_chartLine = [CAShapeLayer layer];
_chartLine.lineCap = kCALineCapButt;
_chartLine.fillColor = [[UIColor whiteColor] CGColor];
_chartLine.lineWidth = self.frame.size.width;
_chartLine.strokeEnd = 0.0;
self.clipsToBounds = YES;
_chartLine = [CAShapeLayer layer];
_chartLine.lineCap = kCALineCapButt;
_chartLine.fillColor = [[UIColor whiteColor] CGColor];
_chartLine.lineWidth = self.frame.size.width;
_chartLine.strokeEnd = 0.0;
self.clipsToBounds = YES;
[self.layer addSublayer:_chartLine];
self.layer.cornerRadius = 2.0;
self.layer.cornerRadius = 2.0;
}
return self;
}
... ... @@ -51,7 +51,6 @@
pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
pathAnimation.autoreverses = NO;
[_chartLine addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
_chartLine.strokeEnd = 1.0;
... ...
... ... @@ -19,9 +19,9 @@
if (self) {
// Initialization code
self.backgroundColor = [UIColor whiteColor];
self.clipsToBounds = YES;
_showLabel = YES;
_barBackgroundColor = PNLightGrey;
self.clipsToBounds = YES;
_showLabel = YES;
_barBackgroundColor = PNLightGrey;
}
return self;
... ... @@ -88,7 +88,7 @@
float value = [valueString floatValue];
float grade = (float)value / (float)_yValueMax;
PNBar * bar = [[PNBar alloc] init];
PNBar * bar;
if (_showLabel) {
bar = [[PNBar alloc] initWithFrame:CGRectMake((index * _xLabelWidth + chartMargin + _xLabelWidth * 0.25), self.frame.size.height - chartCavanHeight - 30.0, _xLabelWidth * 0.5, chartCavanHeight)];
}else{
... ... @@ -99,12 +99,8 @@
bar.grade = grade;
[self addSubview:bar];
index += 1;
}
}
@end
... ...
... ... @@ -22,21 +22,21 @@
UIBezierPath* circlePath = [UIBezierPath bezierPathWithArcCenter:CGPointMake(self.center.x,self.center.y) radius:self.frame.size.height*0.5 startAngle:DEGREES_TO_RADIANS(270) endAngle:DEGREES_TO_RADIANS(270.01) clockwise:NO];
_circle = [CAShapeLayer layer];
_circle.path = circlePath.CGPath;
_circle.lineCap = kCALineCapRound;
_circle.fillColor = [UIColor clearColor].CGColor;
_circle.lineWidth = [_lineWidth floatValue];
_circle.zPosition = 1;
_circleBG = [CAShapeLayer layer];
_circleBG.path = circlePath.CGPath;
_circleBG.lineCap = kCALineCapRound;
_circle = [CAShapeLayer layer];
_circle.path = circlePath.CGPath;
_circle.lineCap = kCALineCapRound;
_circle.fillColor = [UIColor clearColor].CGColor;
_circle.lineWidth = [_lineWidth floatValue];
_circle.zPosition = 1;
_circleBG = [CAShapeLayer layer];
_circleBG.path = circlePath.CGPath;
_circleBG.lineCap = kCALineCapRound;
_circleBG.fillColor = [UIColor clearColor].CGColor;
_circleBG.lineWidth = [_lineWidth floatValue];
_circleBG.strokeColor = PNLightYellow.CGColor;
_circleBG.strokeEnd = 1.0;
_circleBG.zPosition = -1;
_circleBG.zPosition = -1;
[self.layer addSublayer:_circle];
[self.layer addSublayer:_circleBG];
... ... @@ -51,7 +51,7 @@
{
//Add count label
UICountingLabel* gradeLabel = [[UICountingLabel alloc] initWithFrame:CGRectMake(0, 0, 50.0, 50.0)];
UICountingLabel *gradeLabel = [[UICountingLabel alloc] initWithFrame:CGRectMake(0, 0, 50.0, 50.0)];
[gradeLabel setTextAlignment:NSTextAlignmentCenter];
[gradeLabel setFont:[UIFont boldSystemFontOfSize:13.0f]];
[gradeLabel setTextColor: PNDeepGrey];
... ... @@ -65,8 +65,8 @@
//Add circle params
_circle.lineWidth = [_lineWidth floatValue];
_circleBG.lineWidth = [_lineWidth floatValue];
_circleBG.strokeEnd = 1.0;
_circleBG.lineWidth = [_lineWidth floatValue];
_circleBG.strokeEnd = 1.0;
_circle.strokeColor = _strokeColor.CGColor;
//Add Animation
... ... @@ -75,7 +75,6 @@
pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:[_current floatValue]/[_total floatValue]];
pathAnimation.autoreverses = NO;
[_circle addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
_circle.strokeEnd = [_current floatValue]/[_total floatValue];
... ... @@ -83,13 +82,4 @@
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
// Drawing code
}
*/
@end
... ...
... ... @@ -18,14 +18,14 @@
if (self) {
// Initialization code
self.backgroundColor = [UIColor whiteColor];
self.clipsToBounds = YES;
_chartLine = [CAShapeLayer layer];
_chartLine.lineCap = kCALineCapRound;
_chartLine.lineJoin = kCALineJoinBevel;
_chartLine.fillColor = [[UIColor whiteColor] CGColor];
_chartLine.lineWidth = 3.0;
_chartLine.strokeEnd = 0.0;
_showLabel = YES;
self.clipsToBounds = YES;
_chartLine = [CAShapeLayer layer];
_chartLine.lineCap = kCALineCapRound;
_chartLine.lineJoin = kCALineJoinBevel;
_chartLine.fillColor = [[UIColor whiteColor] CGColor];
_chartLine.lineWidth = 3.0;
_chartLine.strokeEnd = 0.0;
_showLabel = YES;
[self.layer addSublayer:_chartLine];
}
... ... @@ -157,7 +157,6 @@
pathAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
pathAnimation.fromValue = [NSNumber numberWithFloat:0.0f];
pathAnimation.toValue = [NSNumber numberWithFloat:1.0f];
pathAnimation.autoreverses = NO;
[_chartLine addAnimation:pathAnimation forKey:@"strokeEndAnimation"];
_chartLine.strokeEnd = 1.0;
... ...