1

I have a UIView that has a UIPanGestureRecognizer in it, so I can drag it everywhere.

I also have a UIButton inside that UIView but the touch event in the button for the .touchUpInside doesn't fire because it is being captured by the panGesture.

If I print the panGesture.state whenever I touch the button the .began state fires and not the button selector handler.

How can I have the gestureRecognizer not capturing the button's touch event?

@objc private func panned(recognizer: UIPanGestureRecognizer) {
    switch recognizer.state {
    case .began: print("began")
        // ...
    }
}
Lukas Würzburger
  • 6,543
  • 7
  • 41
  • 75
Ivan Cantarino
  • 3,058
  • 4
  • 34
  • 73

0 Answers0