我可以直接在场景的 sprite kit 节点中响应触摸,还是需要通过场景的 touchesBegan 方法

Can I respond to touch directly in a sprite kit node on the scene, or do I need to go through the scene's touchesBegan method

我可以直接在场景的 SKSpriteNode 中使用它的 touchesBegan 方法响应触摸,还是我绝对需要先通过场景的 touchesBegan 方法 - 然后将它委托给 sprite/calling 精灵的方法直接地?换句话说,SKSpriteNode能不能捕捉到触摸事件,还是只是场景谁做的?

据我所知,您必须在 touchesBegan 函数内部执行此操作。

你不需要通过场景中的touchBegin方法。你需要做的就是subclassSKSpriteNode,只要把userInteractionEnabled设置为true,你就可以重写class里面的touch属性,让它只有在精灵被触摸了。