1

Hi I am trying to add one indicator at end of arc , But I am not able to get the position and rotation where ARC ends. I am able to draw progress circle

enter image description here Here is my code

     CGMutablePathRef arc = CGPathCreateMutable();
CGPathAddArc(arc, NULL,
             rectSize.width/2, rectSize.height/2,
             MIN(rectSize.width,rectSize.height)/2 - self.progressLineWidth,
             (self.progressAngle/100.f)*M_PI-((-self.progressRotationAngle/100.f)*2.f+0.5)*M_PI-(2.f*M_PI)*(self.progressAngle/100.f)*(100.f-100.f*self.value/self.maxValue)/100.f,
             -(self.progressAngle/100.f)*M_PI-((-self.progressRotationAngle/100.f)*2.f+0.5)*M_PI,
             YES);


CGPathRef strokedArc =
CGPathCreateCopyByStrokingPath(arc, NULL,
                               self.progressLineWidth,
                               (CGLineCap)self.progressCapType,
                               kCGLineJoinMiter,
                               10);


CGContextAddPath(c, strokedArc);
CGContextSetFillColorWithColor(c, self.progressColor.CGColor);
CGContextSetStrokeColorWithColor(c, self.progressStrokeColor.CGColor);
CGContextDrawPath(c, kCGPathFillStroke);

_endPoint = CGPathGetCurrentPoint(arc);
NSLog(@"%f and y = %f",_endPoint.x,_endPoint.y
      );
CGPathRelease(arc);
CGPathRelease(strokedArc);
Kishor
  • 376
  • 4
  • 14
  • You have the center. You know the angle and the radius. So you can find the x/y position. It's simple maths. https://stackoverflow.com/questions/2912779/how-to-calculate-a-point-with-an-given-center-angle-and-radius – Larme Oct 14 '17 at 19:59

0 Answers0