gpt4 book ai didi

ios - UIBezierPath行与其他填充UIBezierPath一起移动吗?

转载 作者:行者123 更新时间:2023-12-01 16:30:13 25 4
gpt4 key购买 nike

这段代码正在创建一个UIBezierPath,它的形状像给定的图像一样呈圆形。

enter image description here

CGPoint arcCenter = CGPointMake(CGRectGetMidX(self.bounds), CGRectGetMidY(self.bounds));
CGFloat radius = CGRectGetWidth(self.bounds) / 2.0f;
float angle = value * 360.0;
float x = radius * sin(angle*M_PI/180.0);
float y = radius * cos(angle*M_PI/180.0);

CGPoint capArcCenter = CGPointMake(arcCenter.x + x, arcCenter.y - y);
UIBezierPath *path = [UIBezierPath bezierPathWithArcCenter:capArcCenter
radius:self.gaugeWidth*_lineLayer.shadowRadius / 2.0f
startAngle:(3.0f * M_PI_2)
endAngle:(3.0f * M_PI_2) + (2.0f * M_PI)
clockwise:YES];
return path;

我希望此线垂直交叉,如下所示。
enter image description here

如何创建一个UIBezierPath,像时钟中的SECONDS行那样穿越。

谢谢。

最佳答案

假设您尝试创建一个单独的UIBezierPath来执行此操作,我建议您简单地创建要表示该行的路径,例如:

 myPath = [UIBezierPath bezierPath];
[myPath moveToPoint:startpoint];
[myPath addLineToPoint:endpoint];

然后对其应用CGAffineTransform使其围绕量规面旋转。

希望有帮助

关于ios - UIBezierPath行与其他填充UIBezierPath一起移动吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32137291/

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