I have a UIView and i have multiple UIImageView's as its subview.
I have added UILongPressGestureRecognizer to each of these subviews.
I handle this gesture in a method where i perform some animation on the sender UIImageView.
If I long press two ImageView's at a time, the animation gets disrupted.
Is there any way I can disable multiple long press gestures simultaneously? i.e allow only one
UIImageView to detect LongPress gesture.
You have actually several ways to solve your problem:
Set
exclusiveTouchto YES for all your image views. It will block the delivery of touch events to other views in the same window.Or you can set flag to ignore other recognizers when one of your recognizers move to Begin state.
Or you can disable gesture recognizers (UIGestureRecognizer has
enabledproperty) except current one in your delegate method and enable all of them again when gesture finishes.