私は単線を描いています
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];
この線に平行線を引きたい。アイデアや計算はありますか?
または、この特定の行のタッチポイントを取得するためのコードはありますか? 実際には、2 本の線の間をタッチするとタッチ ポイントを取得でき、 CGPathContainsPointメソッドから 2 本の線の間のタッチ ポイントを取得できるため、ここで 2 本の平行線を作成します。