Undo [UIGestureRecognizer * requireGestureRecognizerToFail]

Is there a way to undo requireGestureRecognizerToFail.

I have established 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? Is tgr2 really released or does tgr1 now have a link? If not, will tgr2 issue?

thanks

+6
source share
1 answer

Your questions:

How to unregister tgr2 using tgr1?

You have many options.

  • You can remove it from the view.
  • You can disable tgr2.
  • In order to keep the two recognized, you will need to create a new recognizer, the equal of which needs to fail and add it, I do not know how to remove the dependency between them, and I do not know if there is a way.

Is tgr2 running, or does tgr1 now have a link?

tgr2 will not increment the counter when adding requireGestureRecognizerToFail with tgr2 when added to tgr1.

If not, will tgr2 issue?

No, this will not cause a problem, only tgr2 will always fail and will cause tgr1

+3
source

Source: https://habr.com/ru/post/913043/


All Articles