UIScrollView ignoring/passing on 3 touch

十年热恋 提交于 2019-12-08 06:32:17

问题


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.

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.


回答1:


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


来源:https://stackoverflow.com/questions/11758996/uiscrollview-ignoring-passing-on-3-touch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!