简体   繁体   中英

How to enable/disable touchesMoved, touchesEnded and Swipe Gestures

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.

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM