我想UIImageView
使用这种方法根据 xPos 和 yPos 在视图中获取(或我拥有的任何东西):
- (void) touchesMoved: (NSSet *)touches withEvent:(UIEvent *)event {
CGPoint tappedPt = [[touches anyObject] locationInView:viewIndex];
int xPos = tappedPt.x;
int yPos = tappedPt.y;
NSLog(@"xPos %i yPos %i ", xPos, yPos);
// do something with xPos and yPos like add them to an array
}
非常感谢 !