iOS 横向集合试图 把 controller的右边滑动返回拦截

2020-05-22  本文已影响0人  松龄学编程

横向集合试图 把 controller的右边滑动返回拦截了,怎么能让手势传递?

class EdgeBackCollectionView: UICollectionView, UIGestureRecognizerDelegate {
    override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
        super.init(frame: frame, collectionViewLayout: layout)
        panGestureRecognizer.delegate = self
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
        if otherGestureRecognizer is UIScreenEdgePanGestureRecognizer {
            return true
        } else {
            return false
        }
    }
}

上一篇 下一篇

猜你喜欢

热点阅读