我的touchesBegan和touchesEnded的坐标。 但在touchesMoved我可以触摸的到的touchesBegan touchesEnded的所有坐标。 我的意思是,当我把屏幕上的手指拖动到某个位置,然后我举起它。 所以,我可以得到的起始位置,结束位置的所有坐标。 如果可能的话,我怎么能得到它们呢?
Answer 1:
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
}
文章来源: touchesMoved:withEvent