Nayan Chauhan Nayan Chauhan - 1 year ago 122
Objective-C Question

Disable multiple long-press gestures simultaneously

I have a

and i have multiple
as its subview.
I have added
to each of these subviews.
I handle this gesture in a method where i perform some animation on the sender

If I long press two
at a time, the animation gets disrupted.

Is there any way I can disable multiple long press gestures simultaneously? i.e allow only one
to detect LongPress gesture.

Answer Source

You have actually several ways to solve your problem:

Set exclusiveTouch to 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 enabled property) except current one in your delegate method and enable all of them again when gesture finishes.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download