0
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
mouseSwiped = YES;
UITouch *touch = [touches anyObject];
CGPoint currentPoint = [touch locationInView:scrollView];
//[self drawLine:lastPoint.x :lastPoint.y :currentPoint.x :currentPoint.y];
tempShapeLayer = nil;
CGMutablePathRef linePath = nil;
linePath = CGPathCreateMutable();
tempShapeLayer = [CAShapeLayer layer];
tempShapeLayer.lineWidth = 4.0f;
tempShapeLayer.lineCap = kCALineJoinMiter;
tempShapeLayer.strokeColor = [[UIColor redColor] CGColor];
CGPathMoveToPoint(linePath, NULL, lastPoint.x, lastPoint.y);
CGPathAddLineToPoint(linePath, NULL, currentPoint.x, currentPoint.y);
tempShapeLayer.path = linePath;
CGPathRelease(linePath);
[scrollView.layer addSublayer:tempShapeLayer];
lastPoint = currentPoint;
を滑らかではありません。しかし、私はこの線を真っ直ぐにしておきたい。私が私のタッチを動かすとラインがスムーズにならないことを意味します。ラインは真っ直ぐに留まります。
は、私は、あなたが不要なアンチエイリアスを取得するサブピクセルを移動する場合
if (currentPoint.x > lastPoint.x){
currentPoint.y = lastPoint.y;
}
else if (currentPoint.x < lastPoint.x) {
currentPoint.x = lastPoint.x;
}
実際に私はタッチを制限しなければならない、つまり、もし私が縦または横のタッチになったら、それに応じてポイントを設定しなければならないということを意味する。 – PJR
私はこの答えによって答えを得ることはありませんが、それをより詳細に理解するのに役立ちます。 – PJR