iOS手势区分
2021-06-07 本文已影响0人
nick5683
public funcgestureRecognizer(_gestureRecognizer:UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer:UIGestureRecognizer) ->Bool{
let location = gestureRecognizer.location(in: headerView)
if headerView.frame.contains(location){
return false
}
//禁止segmentedView左右滑动的时候,上下和左右都可以滚动
if otherGestureRecognizer == segmentedView.collectionView.panGestureRecognizer {
return false
}
return gestureRecognizer.isKind(of: UIPanGestureRecognizer.self) && otherGestureRecognizer.isKind(of: UIPanGestureRecognizer.self)
}