2013-03-10 5 views
2

나는 numberOfTouchesReguired = 2으로 설정 한 UILongPressGestureRecognizer을 가지고 있습니다. 보기에서 각 손가락의 연속 좌표를 얻으려면 어떻게해야합니까?UILongPressGestureRecognizer의 각 터치 좌표를 가져옵니다.

현재이 기능이 있지만 모든 터치의 위치를 ​​1 개의 좌표로 결합하는 것으로 보입니다.

 
- (void)handleLongPress:(UILongPressGestureRecognizer *)sender { 
    CGPoint locationInView = [sender locationInView:nil]; 
}
+0

@Till 길게 누르면 손가락이 계속 움직이면서 연속 이벤트가 전송됩니다. – rmaddy

+0

@rmaddy 내 잘못, 네 말이 맞아. 또한 허용 된 이동 거리는 구성 가능합니다. – Till

답변

8

UIGestureRecognizer에 대한 문서를 참조하십시오. 이 방법을 제공합니다 :

- (void)handleLongPress:(UILongPressGestureRecognizer *)sender { 
    if (sender.state == UIGestureRecognizerStateChanged) { 
     NSUInteger *touchCount = [sender numberOfTouches]; 
     for (NSUInteger t = 0; t < touchCount; t++) { 
      CGPoint point = [sender locationOfTouch:t inView:sender.view]; 
     } 
    } 
+0

고마워, 그냥 이것도 발견했다. – thisiscrazy4

관련 문제