【发布时间】:2020-06-12 10:21:59
【问题描述】:
我阅读了UIBezierPath 对象的 Apple 文档。我是否正确理解它不支持相对路径?
我正在尝试将此 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)];
...
真的是这样吗?还是我错过了什么?
【问题讨论】:
标签: ios uibezierpath