2016-01-28 19 views
0

每次触摸要移动的节点时,都会触发一个方法,所以我只想在SpriteKit中使用touchesMoved方法时才停止该方法。我尝试在touchesMoved里面像addBlocks()== nil一样写,但是没用。当我触摸一个节点时,我该如何阻止该方法被调用?完成移动该节点后,我希望它再次使用。任何想法?如何在Swift中暂时停止使用方法?

回答

1
addBlocks() == nil // this returns false 

我建议你重写touchesBegan:withEvent:touchesEnded:withEvent:并触发布尔停止被称为addBlocks。或者在touchesBegan事件内拨打addBlocks()

+0

感谢您的快速响应,它的工作!这是我需要的!非常感谢! – Ryo

相关问题