问题描述:

I have two UIViews (custom scroll views) that respond to UISwipeGestureRecognizer. These two UIViews are subviews of the parent UIView. I want to allow only one of the subviews to respond to the recognizer.

In other words, only one should be allowed to be swiped at a time.

Setting setExclusiveTouch = YES on the subviews AND/OR the parent view doesn't have any effect.

How can I make sure that only 1 subview is being swiped at a time?

Here's a picture:

网友答案:

UIScrollView's by default have multipleTouchEnabled set to YES - if you do not need multiple touch (zooming for example requires it), then set it to NO.

相关阅读:
Top