필자는 글쓰기 동안 멀티 터치로 작업하고 있습니다. 기본적으로 내가하는 일은 손으로 쓰는 것입니다. 사용자가 글을 쓰는 방법에 따라이 링크를 따라갔습니다. How to ignore certain UITouch Points in multitouch sequence효과적으로 멀티 터치 시퀀스에서 UITouches를 처리하는 방법
모든 것이 하나의 터치로 잘 작동하지만, 나는 다음은 내 코드 접촉에서
내가 모든 접촉을 통해 이동, 시작은 내 손으로 화면을 터치로 쓰기 여러 UItouches 을 즉 어떤 문제는 내가 터치를 찾을 수 가장 높은 y 위치는 내 코드
다음은 터치에서
-(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;
}
이동 내 코드입니다., 난 단지 걸릴 것 내가 참고로
-(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;
}
}
아래
내 터치 이전 코드 개시 접촉에서 발견 self.trackingTouch, 여기에 각각 싱글 터치와 멀티 터치로 쓰는 이미지가 있습니다
.
그래서 친구가 밖으로
내 생각에 무언가가 터치를 추적하는 데 잘못되어 있다는 것, 그리고 왜 손대지 않는 것입니까? – Ranjit
아마도 사용자의 손을 놓는 위치를 감지하고 그 영역에서 손을 뗄 수 있을까요? 사용자가 그림을 그리기 시작하면 'touchesEnded :'및 'touchesCancelled :'앞에 터치가 아닌 터치를 무시하면 안됩니까? –
안녕하세요 @AaronBrager, 회신 해 주셔서 감사합니다. 이미 알 수 있듯이, 나는 추적 터치를 찾고 y의 높은 값을 기반으로 나머지 터치를 무시하고 터치가 시작되었습니다. 당신이 접촉하기 전에 거의 접촉을 무시해서 똑같은 것을 의미합니까? Ended : and touch Cancelled : 내가 잘못하면 나를 바로 잡으십시오. – Ranjit