Fixing circular progress indicator in iOS 7.

This commit is contained in:
Samuel Clay 2013-09-25 11:37:05 -07:00
parent dbe9523f14
commit a5c898b692

View file

@ -9,7 +9,7 @@
@interface THCircularProgressView () @interface THCircularProgressView ()
@property CGPoint center; @property CGPoint centerPoint;
@property CGFloat radius; @property CGFloat radius;
@end @end
@ -26,12 +26,11 @@ progressBackgroundColor:(UIColor *)progressBackgroundColor
percentage:(CGFloat)percentage percentage:(CGFloat)percentage
{ {
CGRect rect = CGRectMake(center.x - radius, center.y - radius, 2 * radius, 2 * radius); CGRect rect = CGRectMake(center.x - radius, center.y - radius, 2 * radius, 2 * radius);
self = [super initWithFrame:rect]; self = [super initWithFrame:rect];
if (self) { if (self) {
self.backgroundColor = [UIColor clearColor]; self.backgroundColor = [UIColor clearColor];
self.center = CGPointMake(radius, radius); self.centerPoint = CGPointMake(radius, radius);
self.radius = radius; self.radius = radius;
self.lineWidth = lineWidth; self.lineWidth = lineWidth;
@ -49,7 +48,7 @@ progressBackgroundColor:(UIColor *)progressBackgroundColor
[self addSubview:self.centerLabel]; [self addSubview:self.centerLabel];
} }
return self; return self;
} }
@ -71,7 +70,7 @@ progressBackgroundColor:(UIColor *)progressBackgroundColor
} }
case THProgressBackgroundModeCircumference: { case THProgressBackgroundModeCircumference: {
CGFloat radiusMinusLineWidth = self.radius - self.lineWidth / 2; CGFloat radiusMinusLineWidth = self.radius - self.lineWidth / 2;
UIBezierPath *progressCircle = [UIBezierPath bezierPathWithArcCenter:self.center UIBezierPath *progressCircle = [UIBezierPath bezierPathWithArcCenter:self.centerPoint
radius:radiusMinusLineWidth radius:radiusMinusLineWidth
startAngle:0 startAngle:0
endAngle:2 * M_PI endAngle:2 * M_PI
@ -105,7 +104,7 @@ progressBackgroundColor:(UIColor *)progressBackgroundColor
- (void)drawProgressArcWithStartAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle radius:(CGFloat)radius - (void)drawProgressArcWithStartAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle radius:(CGFloat)radius
{ {
UIBezierPath *progressCircle = [UIBezierPath bezierPathWithArcCenter:self.center UIBezierPath *progressCircle = [UIBezierPath bezierPathWithArcCenter:self.centerPoint
radius:radius radius:radius
startAngle:startAngle startAngle:startAngle
endAngle:endAngle endAngle:endAngle