How to enable/disable touchesMoved, touchesEnded and Swipe Gestures

714 Views Asked by At

I am working on a game where I need touchesMoved and touchesEnded but after the stage is completed, I want to DISABLE touchesMoved and touchesEnded and enable only SWIPE GESTURES.

So how can I achieve this?

When the game is being played: I want swipe gestures to be disabled and touchesBegan, touchesMoved, touchesEnded should be enabled.

When the game is completed: I want touchesBegan, touchesMoved, touchesEnded to be disabled And swipe gestures to be enabled.

Please help me out. Thanks.

1

There are 1 best solutions below

0
kb920 On

When you want to disable touch return false in below method.

 func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
    return false
}