我正在尝试跟踪用户是否在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的正确方法是什么?
答案 0 :(得分:0)
UIScrollView
的这些属性可能是最好的选择,而不是弄乱
- (void)touchesBegan
- (void)touchesCancelled
- (void)touchesEnded
种方法
if (yourScrollView.isTracking || yourScrollView.isZooming || yourScrollView.isDragging)
{
// User interacting
}