0

我有一个带有 UIPinchGesture 的 UIScrollView。我的问题是,如果我做一个捏手势,它会移动 UIScrollView,并且在 NSLogging UIScrollView 的 X/Y 时可以看到这一点。我想知道是否有人有任何想法来防止在滚动视图上发生这种情况?

我已经设置了最小和最大缩放比例:

[scrollView setMaximumZoomScale: 1.0];
[scrollView setMinimumZoomScale: 1.0];

我也有 UIScrollView 的子类并实现了 touchesBegan 和 touchesEnded 但我不确定如果使用 2 根手指我将如何忽略滚动视图上的触摸?

请指教。

4

1 回答 1

0

您可以明智地使用 ScrollEnabled 属性。

还可以在使用两根手指时取消触摸,

 -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    NSSet *allTouches = [event allTouches];

    if ([allTouches count] > 1)
    {
        [self touchesCancelled:touches withEvent:event];
    }
    else
    {
        //pass touch.
    }
}
于 2012-02-21T07:59:15.327 回答