检测UIScrollView上的用户触摸

检测UIScrollView上的用户触摸

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

问题描述

我基本上想要检测用户何时滚动并从屏幕上移开他的手指。最简单的是什么?我正在考虑使用:

I basically wanted to detect when a user scrolls and removes his finger from the screen. What is the easiast for this? I was thinking of using:

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event;
{
    NSLog(@"TOUCH ENDED");
}

但我把它放在我的UIViewController中,但它没有被调用

but I put this in my UIViewController, but it isn't get called

推荐答案

如何使用 UIScrollViewDelegate 功能

(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate

当用户在拖动滚动视图后抬起手指时会调用此方法。
请参阅此处:

This gets called when the user lifts the finger after dragging the scroll view.See here: UIScrollViewDelegate Documentation

这篇关于检测UIScrollView上的用户触摸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 09:23