开发者

touchesMoved:withEvent

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜