gpt4 book ai didi

ios - UIBezierPath 支持相对路径?

转载 作者:行者123 更新时间:2023-12-01 19:31:53 32 4
gpt4 key购买 nike

我将 Apple 文档阅读到 UIBezierPath目的。我是否正确理解它不支持相对路径?
我正在尝试将此 svg 路径转换为 ​​UIBezierPath:

// svg path
m90 36c-7 0-13 6-13 13s6 13 13 13 13-6 13-13-6-13-13-13zm-27 32c-7 0-13 6-13 13s6 13 13 13 13-6 13-13-6-13-13-13z
我开始于:
UIBezierPath* myPath = [UIBezierPath bezierPath];
CGPoint currentPoint;

[myPath moveToPoint:CGPointMake([self sizeDependendX:90], [self sizeDependendY:36])];
currentPoint = CGPathGetCurrentPoint(myPath.CGPath);
[myPath addCurveToPoint:CGPointMake(currentPoint.x - 13, currentPoint.y + 13)
controlPoint1:CGPointMake(currentPoint.x + 7, currentPoint.y + 0)
controlPoint2:CGPointMake(currentPoint.x - 13, currentPoint.y + 6)];
currentPoint = CGPathGetCurrentPoint(myPath.CGPath);
[myPath addCurveToPoint:CGPointMake(currentPoint.x + 13 ,currentPoint.y + 13)
controlPoint1:CGPointMake(currentPoint.x + 0, currentPoint.y + 7)
controlPoint2:CGPointMake(currentPoint.x + 6, currentPoint.y + 13)];
...
真的是这样吗,还是我在这里错过了什么?

最佳答案

确实,只有 “相对”点。
(如果真的需要,做一个扩展、函数或其他一些糖来使它整洁是微不足道的。在 Swift 中,我通常有类似的东西

go(across: 7.0, down: -2.5)
go(across: 4.0, down: -2.5)
go(across: 7.0, down: -2.5)
.. 那类的东西。它只是您想要的功能或扩展的几行代码。)
关于这些坏消息我很遗憾! :)

我们做了很多与贝塞尔曲线相关的事情,下面是一些典型的代码如何寻找我们。我使用了无数的帮助程序调用,以便代码更有意义。
我想说的是,在编写代码以创建复杂的贝塞尔 Material 时,确实必须建立在 Apple 的原语之上。
enter image description here

关于ios - UIBezierPath 支持相对路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62342244/

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