检测用户是否在iOS 7中的UIScrollView区域中有(a)手指

时间:2014-07-16 16:59:01

标签: ios uiscrollview

我正在尝试跟踪用户是否在UIScrollView区域中有手指(或手指)。我覆盖了UIScrollView的- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event,以跟踪“向下”和“向上”的触摸次数。

这看起来效果不错,但是当屏幕被淘汰时,似乎UIScrollView不会调用这些方法。

检测用户是否正在接触UIScrollView的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

UIScrollView的这些属性可能是最好的选择,而不是弄乱

- (void)touchesBegan - (void)touchesCancelled - (void)touchesEnded种方法

if (yourScrollView.isTracking || yourScrollView.isZooming || yourScrollView.isDragging)
{
    // User interacting
}