Iphone 触摸移动:withEvent

Iphone 触摸移动:withEvent,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,我得到了触摸开始和触摸结束的坐标。 但是在touchsmoved中,我可以从touchsbegind到touchsended获得所有的触摸坐标。 我的意思是,当我把手指放在屏幕上,拖到某个位置,然后我举起它。 所以,我可以得到从起始位置到结束位置的所有坐标。 如果可能,我如何获取它们?每当触摸屏上有移动时,就会调用touchsmoved。如果您想要一个包含所有点的数组,则需要在每次调用touchesMoved时将它们添加到可变数组中 - (void) touchesMoved: (NSSet *

我得到了触摸开始和触摸结束的坐标。 但是在touchsmoved中,我可以从touchsbegind到touchsended获得所有的触摸坐标。 我的意思是,当我把手指放在屏幕上,拖到某个位置,然后我举起它。 所以,我可以得到从起始位置到结束位置的所有坐标。
如果可能,我如何获取它们?

每当触摸屏上有移动时,就会调用touchsmoved。如果您想要一个包含所有点的数组,则需要在每次调用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
}

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
}

CGPoint-tappedPt=[[toucheanyobject]locationInView:self.view];CGPoint-tappedPt=[[toucheanyobject]locationInView:self.view];