UIScrollView忽略/传递3点触摸 [英] UIScrollView ignoring/passing on 3 touch

查看:113
本文介绍了UIScrollView忽略/传递3点触摸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我查看了一堆可能重复的其他问题。但是,所提到的解决方案似乎都没有效果。此外,答案往往分散且不完整。

So I have looked over a bunch of other questions that could possible be duplicates. But none of the solutions that have been mentioned seem to work. Also, the answers tend to be scattered and incomplete.

因此,我在子类UIScrollView中有一个UIView。我需要做的就是让UIScrollview忽略用3个手指可以发生的所有形式的手势,而是将其传递给内部的UIView。有人可以帮我解决这个问题。

So, I have a UIView inside of a subclassed UIScrollView. All I need to do is have the UIScrollview ignore all forms of gesture that can occur with 3 fingers and, instead, pass it on to the UIView inside. Could someone help me with this.

推荐答案

你需要子类化scrollview来完成这个任务。我刚刚用UITableView测试了这种技术并且它工作正常。

You need to subclass the scrollview to accomplish this. I tested this technique with a UITableView just now and it worked.

@interface OneTwoTouchScrollView : UIScrollView
@end

@implementation OneTwoTouchScrollView

-(BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer*)recognizer
{
    return recognizer.numberOfTouches < 3 && [super gestureRecognizerShouldBegin:recognizer];
}

@end

这篇关于UIScrollView忽略/传递3点触摸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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