iOS:UIScrollView检测Swipe Gesture [英] iOS: UIScrollView detecting Swipe Gesture

查看:77
本文介绍了iOS:UIScrollView检测Swipe Gesture的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIScrollView,它使用一个计时器自动滚动,计时器每隔3秒滚动到下一页(幻灯片播放)。

I have an UIScrollView which scrolls automatically by using a timer, which scrolls every 3 seconds to the next page (kind of slideshow).

现在我想实现一个功能,它检测任何用户交互,一旦用户与滚动视图交互,就取消定时器,这样他就可以自己滚动浏览滚动视图。

Now I want to implement a function which detects any user interaction, to cancel the timer as soon as the user interacts with the scrollview, so that he can scroll through the scrollview by himself.

什么会是最好的方法吗?
ScrollView没有子类,并且正在使用UIScrollViewDelegate。

What would be the best way to do this? The ScrollView isn't subclassed and is using the UIScrollViewDelegate.

对于某些提示会很高兴。
干杯。

Would be glad for some hints. Cheers.

推荐答案

UIScrolViewDelegate有一种方法来检测用户何时开始拖动:

UIScrolViewDelegate has a method to detect when the user "began" dragging:

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
    // disable timer here
}

这篇关于iOS:UIScrollView检测Swipe Gesture的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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