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班。你需要转换坐标