Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 使用CAShape图层绘制两条平行线_Iphone_Objective C_Ios_Draw_Cashapelayer - Fatal编程技术网

Iphone 使用CAShape图层绘制两条平行线

Iphone 使用CAShape图层绘制两条平行线,iphone,objective-c,ios,draw,cashapelayer,Iphone,Objective C,Ios,Draw,Cashapelayer,我正在用 CAShapeLayer *lineShape = nil; CGMutablePathRef linePath = nil; linePath = CGPathCreateMutable(); lineShape = [CAShapeLayer layer]; lineShape.lineWidth = 1.0f; lineShape.lineCap = kCALineJoinMiter; lineShape.strokeColor = [[UIColor redColor] CG

我正在用

CAShapeLayer *lineShape = nil;
CGMutablePathRef linePath = nil;
linePath = CGPathCreateMutable();
lineShape = [CAShapeLayer layer];

lineShape.lineWidth = 1.0f;
lineShape.lineCap = kCALineJoinMiter;
lineShape.strokeColor = [[UIColor redColor] CGColor];


CGPathMoveToPoint(linePath, NULL, x, y);
CGPathAddLineToPoint(linePath, NULL, toX, toY);

lineShape.path = linePath;
CGPathRelease(linePath);

[myView.layer addSublayer:lineShape];
我想画一条与这条线平行的线。有什么想法或计算吗

或者是否有任何代码来获取这条特定线路的接触点。实际上,当我在两条线之间进行接触时,我可以得到接触点,通过CGPathContainsPoint方法,我可以得到两条线之间的接触点,因此我想在这里创建两条平行线。

b班。你需要转换坐标