I am working with multitouch while writing. So basically I do this, I write with hand support, because, as a rule, as he writes, I followed this link How to ignore certain UITouch points in a multitouch sequence
Everything works fine with one touch, but their problem occurs when I write with my hand, touching the screen, for example, with several UItouches Below is my code
The touches started, I look through all the touches, and I find the touch with the highest position y, below is my code
Below is my code
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch* topmostTouch = self.trackingTouch; for (UITouch *touch in touches) { ctr = 0; touchStartPoint1 = [touch locationInView:self]; if(!topmostTouch || [topmostTouch locationInView:self].y > touchStartPoint1.y) { topmostTouch = touch; pts[0] = touchStartPoint1; } } self.trackingTouch = topmostTouch; }
In touches moves., I will take only self.trackingTouch, which I found in touches. Began
My Strokes Moved code below
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { if(self.trackingTouch== nil) { return; } CGPoint p = [self.trackingTouch locationInView:self]; ctr++; pts[ctr] = p; if (ctr == 4) { pts[3] = midPoint(pts[2], pts[4]); self.currentPath = [[DrawingPath alloc] init]; [self.currentPath setPathColor:self.lineColor]; self.currentPath.pathWidth = [NSString stringWithFormat:@"%f",self.lineWidth]; [self.currentPath.path moveToPoint:pts[0]]; [self.currentPath.path addCurveToPoint:pts[3] controlPoint1:pts[1] controlPoint2:pts[2]]; [self setNeedsDisplay]; pts[0] = pts[3]; pts[1] = pts[4]; ctr = 1; } }
For reference, here is the image of the image with one touch and multi-touch, respectively


You can see that when I write with one touch, my writing is smooth, the curves are smooth, but when I write with manual peace, my curves become jagged, as you can see in the second image.
So friends, please help me.
ios core-graphics uibezierpath uiresponder uitouch
Ranjit Feb 22 '14 at 9:18 2014-02-22 09:18
source share