-4
원호를 0에서 시작하는 시계 방향으로 그리는 방법. 호가 0에서 시작해야하고 호 끝 점이 다를 수 있습니다. . 그림과 같이 내가 원하는 무엇 는시계 방향으로 원호를 그리십시오.
원호를 0에서 시작하는 시계 방향으로 그리는 방법. 호가 0에서 시작해야하고 호 끝 점이 다를 수 있습니다. . 그림과 같이 내가 원하는 무엇 는시계 방향으로 원호를 그리십시오.
왼쪽에서 호를 시작했다 (- 180)와 나는
-(void)drawRect:(CGRect)rect{
[super drawRect:rect];
CGRect customRect = rect;
customRect.origin.x = 5;
customRect.origin.y = 6;
customRect.size.width = rect.size.width -10;
customRect.size.height = rect.size.height - 12;
radius = customRect.size.width/2 - ((customRect.size.width/2)*0.3);
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(ctx, 1.0, 0.0, 0.0, 1.0);
CGContextFillEllipseInRect (ctx, customRect);
CGContextStrokeEllipseInRect(ctx, customRect);
CGContextFillPath(ctx);
CGContextSetRGBStrokeColor(ctx, 0.0, 0.0, 1.0, 1.0);
CGContextAddArc(ctx, self.frame.size.width/2 , self.frame.size.height/2, radius , -M_PI, ToRad(self.angle), 0);
CGContextSetLineWidth(ctx, customRect.size.width/2 - (radius + 2));
CGContextDrawPath(ctx, kCGPathStroke);
}
당신이 찾고 귀찮게 도움이 되었습니까 방법으로했다 문서화하거나 연구를 수행합니까? 어쩌면 "cgcontext"와 "arc"라는 단어를 검색할까요? 'CGContextAddArc()'를 찾을 수 있어야합니다 –
@rdurand OP가 원을 움직이기 원한다면 그 질문은 속임수 일뿐입니다 –
"시계 방향으로 원호를 그리는 법"이 저에게 많이 들립니다 .. – rdurand