Ios 如何使用CGPathAddArc在弧的末端放置指示器或图像
嗨,我试图在弧的末端添加一个指示器,但我无法获得弧结束的位置和旋转。我能画进度圈 这是我的密码Ios 如何使用CGPathAddArc在弧的末端放置指示器或图像,ios,objective-c,Ios,Objective C,嗨,我试图在弧的末端添加一个指示器,但我无法获得弧结束的位置和旋转。我能画进度圈 这是我的密码 CGMutablePathRef arc = CGPathCreateMutable(); CGPathAddArc(arc, NULL, rectSize.width/2, rectSize.height/2, MIN(rectSize.width,rectSize.height)/2 - self.progressLineWidth,
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);
你有中心。你知道角度和半径。所以你可以找到x/y的位置。这是简单的数学。你有中心。你知道角度和半径。所以你可以找到x/y的位置。这是简单的数学。