UISwipeGestureRecognizer未触发 [英] UISwipeGestureRecognizer not firing

查看:111
本文介绍了UISwipeGestureRecognizer未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IB中有一个UISwipeGestureRecognizer设置链接到我的视图,如下所示:

I have a UISwipeGestureRecognizer setup in IB linked to my view like so:

极其微不足道,完成了一百万次。但是这次它永远不会激发>:|

Extremely trivial, done it a million times. However this time it never fires >:|

这是我的方法,当用户滑动时,应该被调用。

Here is my method that should be called when a user swipes.

然而,这永远不会被调用。

However this never gets called.


  • 不会意外地添加到子视图中

  • 是的Pan手势完美无缺。

我有另一个视图设置几乎完全相同,工作正常。有任何想法吗?

I have another view setup almost exactly the same as this that works fine. Any ideas?

推荐答案

在ViewController中尝试此委托方法

Try this delegate Method in your ViewController

返回 YES 保证允许同时识别并返回 NO 不能保证阻止同时识别,因为另一个手势的代表可能会返回

Returning YES is guaranteed to allow simultaneous recognition and returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{

  return YES;

}

这篇关于UISwipeGestureRecognizer未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆