[英]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
. 我正在开发需要touchesMoved
和touchesEnded
的游戏,但是在阶段完成之后,我想禁用touchesMoved
和touchesEnded
并仅启用SWIPE GESTURES
touchesEnded
。
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. 在玩游戏时 :我希望禁用滑动手势, touchesEnded
应该启用touchesBegan
, touchesMoved
, touchesEnded
。
When the game is completed : I want touchesBegan
, touchesMoved
, touchesEnded
to be disabled And swipe gestures to be enabled. 游戏结束时 :我希望touchesBegan
, touchesMoved
, touchesEnded
被禁用,并且要启用滑动手势。
Please help me out. 请帮帮我。 Thanks. 谢谢。
When you want to disable touch return false in below method. 如果要禁用触摸,请按以下方法返回false。
func gestureRecognizer(gestureRecognizer: UIGestureRecognizer, shouldReceiveTouch touch: UITouch) -> Bool {
return false
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.