0

I have a UILongPressGestureRecognizer which is fired when there is 1 finger on the screen. However, as soon as I put 2 fingers, the function is not fired anymore and I need to create a new gesture for 2 fingers. How to have UILongPressGestureRecognizer to accept a flexible amount of touches ?

let longScreenGesture = UILongPressGestureRecognizer(target: self, action: #selector(screenTapped(_:)))
longScreenGesture.minimumPressDuration=0.1
longScreenGesture.allowableMovement=0
longScreenGesture.numberOfTouchesRequired=1
sceneView.isMultipleTouchEnabled=true
sceneView.addGestureRecognizer(longScreenGesture)

@objc func screenTapped(_ sender: UILongPressGestureRecognizer)
{
        print(sender.numberOfTouches) // -> Always displays 1
}
Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89

1 Answers1

0

I ended up using TouchesBegan / Moved / Ended and analyzed gestures by myself

Laurent Crivello
  • 3,809
  • 6
  • 45
  • 89
  • I don't think this should be marked as an accepted answer, it's not an answer to your question. In my case I can't use touchesBegan/Moved/Ended because I am working inside a UIScrollView which overrides those due to its panGestureRecgonizer. – Albert Renshaw Dec 28 '22 at 04:16