我得到了touchesBegan和touchesEnded的坐标。但在touchesMoved中,我能得到从touchesBegan到touchesEnded的所有触摸坐标吗?我的意思是,当我把手指放在屏幕上,拖到某个位置,然后我把它举起来。那么,我能得到从起始位置到结束位置的所有坐标吗?如果可能,我怎样才能得到它们?
发布于 2009-11-22 13:58:38
每当触摸上有移动时,就会调用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
}https://stackoverflow.com/questions/1777940
复制相似问题