Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo [UIGestureRecognizer* requireGestureRecognizerToFail]

Is there a way to undo requireGestureRecognizerToFail.

I set up a dependency between two UIGestureRecognizers with requireGestureRecognizerToFail like this.

UITapGestureRecognizer* tgr1 = [UITapGestureRecognizer alloc] initWithTarget ...];
UITapGestureRecognizer* tgr2 = [UITapGestureRecognizer alloc] initWithTarget ...];
[tgr1 requireGestureRecognizerToFail: tgr2];
... 
// later in the code
[tgr2 release];

How do I unregister tgr2 with tgr1? Does tgr2 actually released or does tgr1 now have a reference? If not, will releasing tgr2 cause problems?

Thanks

like image 908
bbrame Avatar asked Apr 12 '12 14:04

bbrame


1 Answers

Your questions:

How do I unregister tgr2 with tgr1?

You have many options.

  1. You can remove it from the view.
  2. You can disable tgr2.
  3. To keep the two recognizes you will need to create a new recognizer equal that was require to fail and add it, I do not know how to only remove the dependence between they, and do not know if is there a way.

Does tgr2 actually released or does tgr1 now have a reference?

tgr2 will not have the the retain count incremented when you add to tgr1 requireGestureRecognizerToFail with tgr2.

If not, will releasing tgr2 cause problems?

No, it will no cause problem, only that tgr2 will always fail and it will call tgr1

like image 193
ggrana Avatar answered Sep 27 '22 18:09

ggrana