本文介绍了手势方法(Pan Gesture和Swipe Gesture)之间是否有任何优先条件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个应用程序,我使用了Pan Gesture以及Swipe Gesture。因此,每次我执行Swipe Gesture时,Pan手势中的方法总是被调用,并且Swipe Gesture方法不会被调用。

I am developing an application where I have used the Pan Gesture as well as Swipe Gesture. So every time I do the Swipe Gesture but the method from the Pan Gesture is always getting called and Swipe Gesture method is not getting called.

所有之间是否有任何优先级手势方法?

Is there any priority between all the gesture method?

推荐答案

您可以通过实现 UIGestureRecognizerDelegate的以下方法并行调用它们协议:

- (BOOL)gestureRecognizer:(UIPanGestureRecognizer *)gestureRecognizer
shouldRecognizeSimultaneouslyWithGestureRecognizer:(UISwipeGestureRecognizer *)otherGestureRecognizer
{
    return YES;
}

这篇关于手势方法(Pan Gesture和Swipe Gesture)之间是否有任何优先条件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 13:49