UICollectionView子视图移动而不滚动

时间:2018-05-23 18:13:56

标签: ios swift uicollectionview

我有一个视图,它是一个集合视图子视图。如果我对这个观点感兴趣,我想提出这个观点。但是会发生什么是集合视图滚动了一下,直到我在手势开始事件中滚动关闭。所以我尝试过不要只是跳过触摸事件的集合视图:

func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
    if gestureRecognizer == collectionView!.panGestureRecognizer && item.frame.contains(touch.location(in: self.collectionView!)) == true {
        return false
    }
    return true
}

但问题仍然存在,集合视图仍然滚动..

1 个答案:

答案 0 :(得分:1)

UICollectoinView是UIScrollView的子类,尝试探索在UIScrollView上解决多个手势的帖子,你可以从这里开始:

ScrollView gesture recognizer eating all touch events

相关问题