我将Apple文档阅读到UIBezierPath对象。我是否正确理解它不支持相对路径?
我正在尝试将此路径转换为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)];
...
这真的意味着要那样吗,还是我想念这里的东西?
的确,仅存在no个“相对”点。
((如果真的需要,可以进行扩展,功能或其他一些修饰使其整洁,这很简单。在Swift中,我有类似的东西
go(across: 7.0, down: -2.5)
go(across: 4.0, down: -2.5)
go(across: 7.0, down: -2.5)
..有点。您所需的功能或扩展仅几行代码。)
很抱歉这个坏消息! :)