gpt4 book ai didi

ios - 如何在 Swift 中暂时停止使用某个方法?

转载 作者:行者123 更新时间:2023-11-29 01:17:02 24 4
gpt4 key购买 nike

每次我触摸一个节点移动时,都会触发一个方法,所以我只想在 SpriteKit swift 中使用 touchesMoved 方法时才停止该方法。我尝试在 touchesMoved 中编写类似 addBlocks() == nil 的代码,但没用。当我触摸一个节点时,我如何才能停止调用该方法?完成移动该节点后,我希望它再次被使用。任何想法?

最佳答案

addBlocks() == nil // this returns false

我建议您覆盖 touchesBegan:withEvent:touchesEnded:withEvent: 并触发一个 bool 值来停止调用 addBlocks。或者在 touchesBegan 事件中调用 addBlocks()

关于ios - 如何在 Swift 中暂时停止使用某个方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35051227/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com