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获取触摸事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 09:23