我成功编码了一个可拖动的图像但是,如果你随机点击屏幕中的某个地方,它就会传送到那个点。我不想要那个! 当手指放在图像上时,如何使图像只能拖动? 这是我的代码:
-(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
symbol1.center = location;
}
-(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesBegan:touches withEvent:event];
}