Prevent UIScrollView scrolling while subview is dragged

I have a UIButton within a UIScrollView with paging. I have implemented

UIControlEventTouchDragInside

[transButton addTarget:self action:@selector(dragMoving:withEvent:) forControlEvents: UIControlEventTouchDragInside];

event for that button. Some times when the button is dragged the the scroll view scrolls to next page.

How can I prevent the scrollview detecting the swipe event when the UIButton is dragged?

Thanks.


从文档中,使用requireGestureRecognizerToFail:

[[scrollView panGestureRecognizer] requireGestureRecognizerToFail:yourSwipeGestureRecognizer];
链接地址: http://www.djcxy.com/p/40538.html

上一篇: 如何去除一个字符串在PHP中的所有空间?

下一篇: 拖动子视图时防止UIScrollView滚动