gpt4 book ai didi

iphone - 如何使用 Core Graphics 绘制弧线以及如何旋转该弧线

转载 作者:行者123 更新时间:2023-12-01 16:57:50 24 4
gpt4 key购买 nike

我想使用 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);

我想旋转这个弧线。谁能帮我做这个动画谢谢!!

最佳答案

您可以尝试使用 CGAffineTranform,而不是旋转 View 。
或者通过在矩阵上乘以点的坐标手动旋转每个点,如下所示:

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

关于iphone - 如何使用 Core Graphics 绘制弧线以及如何旋转该弧线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9937252/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com