Search code examples
iphonecocoa-touchanimationquartz-graphics

Locking UIImageView while moving


I move a UIImageView with touchesBegan, touchesMoved, touchesEnded. It works well, but the touches get also applied to other UIImageViews, laying around.

How do I lock touching activity while moving the UIImageView? I've tried this with a boolean value, but it hasn't worked, because touchesMoved get called every time the UIImageView moves, not only one time.


Solution

  • If I understand correctly, you're trying to make it so that only one imageView can be affected by user interaction at any time. If that's the case, just set imageView.exclusiveTouch = YES. Once a touch begins in any view with exclusiveTouch enabled, no other view in that window will register any touches.