Gesture problem: UISwipeGestureRecognizer + UISlider

前端 未结 3 1483
温柔的废话
温柔的废话 2020-12-01 03:41

Got a gesture related problem. I implemented UISwipeGestureRecognizer to get swipe left and right events and that is working fine. However the problem I\'m facing is that th

3条回答
  •  萌比男神i
    2020-12-01 04:15

    Swift 4.0 version. Don't forget the UIGestureRecognizerDelegate.

    func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool {
    
        if let touchedView = touch.view, touchedView.isKind(of: UISlider.self) {
            return false
        }
    
        return true
    }
    

提交回复
热议问题