I got the coordinates of touchesBegan and touchesEnded. But in touchesMoved can I get all the coordinates of the touch from touchesBegan to开发者_Go百科 touchesEnded. I mean that when I put finger on screen and dragged to some position and then I lifted it. So, can I get all the coordinates of the starting position to end position. If possible, how I can I get them ?
TouchesMoved gets called whenever there is movement on the touch. If you want an array of all points you'll need to add them to a mutable array every time touchesMoved is called.
- (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
}
精彩评论