2009-11-22 8 views
1

나는 touchesBegan 좌표와 touchesEnded 좌표를 얻었다. 하지만 touchesMoved에서 touch의 모든 좌표를 touchesBegan에서 touchesEnded로 가져올 수 있습니까? 나는 화면에 손가락을 대고 어떤 자세로 끌었을 때 나는 그것을 들었다. 그래서 시작 위치의 모든 좌표를 끝 위치로 가져올 수 있습니까? 가능하면 어떻게받을 수 있습니까?touchesMoved : withEvent

답변

5

터치시 움직임이있을 때마다 TouchesMoved가 호출됩니다. 모든 점의 배열을 원한다면 touchesMoved가 호출 될 때마다 변경 가능한 배열에 추가해야합니다.

- (void) touchesMoved: (NSSet *)touches withEvent:(UIEvent *)event { 
    CGPoint tappedPt = [[touches anyObject] locationInView: self]; 
    int  xPos = tappedPt.x; 
    int  yPos = tappedPt.y; 
    // do something with xPos and yPos like add them to an array 
} 
+0

CGPoint tappedPt = [[touches anyObject] locationInView : self.view]; –

관련 문제