UITapGestureRecognizer

UITapGestureRecognizer

本文介绍了UIScrollview 获取触摸事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何检测UIScrollView 中的触摸点?触摸委托方法不起作用.

How can I detect touch points in my UIScrollView? The touches delegate methods are not working.

推荐答案

设置点击手势识别器:

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(singleTapGestureCaptured:)];
[scrollView addGestureRecognizer:singleTap];

你会得到接触:

- (void)singleTapGestureCaptured:(UITapGestureRecognizer *)gesture
{
    CGPoint touchPoint=[gesture locationInView:scrollView];
}

这篇关于UIScrollview 获取触摸事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 07:14