如何使用核心图形绘制圆弧,以及如何旋转该圆弧



我想用Core Graphics绘制一条弧,并想旋转该弧

    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetLineWidth(context, 2);
    CGContextSetStrokeColorWithColor(context, [UIColor blueColor].CGColor);
    CGContextMoveToPoint(context, 0, 500);
//    CGContextAddCurveTopoPoint(context, 0, 500, 50, 90, 180, 1);
    CGContextAddArc(context, 60, 500, 50, 90, 180, 0);
    CGContextStrokePath(context);

我想旋转这个弧线。有人能帮我怎么做这个动画吗?谢谢!!

您可以尝试使用CGAffineTransform,而不是旋转视图。或者通过在矩阵上乘以点的坐标手动旋转每个点,看起来像:

| cos x   sin x |
| -sin x  cos x |

最新更新