我正在通过
绘制单行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 方法我可以获得两条线之间的触点,因此我想在这里创建两条平行线。