I have a UIView
that has a UILongPressGestureRecognizer
in it like this:
movementGestureRecognizer = [[UILongPressGestureRecognizer alloc] init];
[movementGestureRecognizer setDelegate:self];
[movementGestureRecognizer setMinimumPressDuration:0.0f];
[self addGestureRecognizer:movementGestureRecognizer];
Has you can see by the name of it, it's used to, as soon, as I long press the UIView
, I am able to move it around.
The thing is, I want also to be able to add some other kind of gestures, for example:
optionsGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(options:)];
[optionsGestureRecognizer setNumberOfTapsRequired:2];
[self addGestureRecognizer:optionsGestureRecognizer];
The problem is that, I am not able to call options:
because the movementGestureRecognizer
is "sucking" all the gestures. Is there are a way to prevent, or cancel the movementGestureRecognizer
or delay it?
Edit 1.0
I am able to call options:
from the TapGestureRecognizer
if I do the following:
[movementGestureRecognizer setMinimumPressDuration:0.1f];
Still, it's not the perfect solution in terms of usability...
I was able to come with a solution by doing the following:
1) Implementing a "state machine" on my UIView
, by disabling and enabling UIGestureRecognizers
based on the state of it.
2) Use a UIPanGestureRecognizer
for moving the UIView's
around.
3) And this question.