UISwipeGestureRecognizer与UIScrollView冲突

时间:2014-09-05 02:09:41

标签: ios uiscrollview uiswipegesturerecognizer

视图层次结构如下:正常的UIView位于底部,底部添加了UIScrollView,其contentSize等于底部视图的大小。然后," UISwipeGestureRecognizer"在底部视图中添加滑动方向为" UISwipeGestureRecognizerDirectionRight"。

我想要做的是,当向上和向下滑动时,scrollView将移动,当向右滑动时,将触发swipeGesture。

但问题是从未检测到swipeGesture。如何解决问题?谢谢!

1 个答案:

答案 0 :(得分:1)

itenyh 自己的答案转移到适当的位置。

通过以下YES方法返回UIGestureRecognizerDelegate将完成此任务:

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    return YES;
}