DACircularProgress Track Circle is bigger than Progress Circle

I need to draw a countdown timer circle, I am using this open source library . The requirement is that the circle fills in green and disappears after x seconds. I returned the round green color and drew a white circle on it, and the green circle looked like it was disappearing.

self.circularTimer.trackTintColor = [UIColor greenColor];
self.circularTimer.progressTintColor = [UIColor whiteColor];
self.circularTimer.thicknessRatio = 5.0f;
[self startAnimation];

      

Everything works fine, but there is a small problem, the circle border is visible. Because the back circle is slightly larger than the top white circle.

http://img651.imageshack.us/img651/1415/circleav.png

+3


source to share


1 answer


Go to your DACircularProgressView.m in function - (void) drawInContext context: (CGContextRef) and on this line

CGFloat radius = MIN(rect.size.height, rect.size.width) / 2;

      

insert this line

CGFloat radiusTint= MIN(rect.size.height, rect.size.width) / 2.1;

      



and replace the line with

CGPathAddArc(trackPath, NULL, centerPoint.x, centerPoint.y, radius, 3 * M_PI_2, -M_PI_2, NO);

      

this line

CGPathAddArc(trackPath, NULL, centerPoint.x, centerPoint.y, radiusTint, 3 * M_PI_2, -M_PI_2, NO);

      

+1


source







All Articles