iOS7 Sprite Kit how to disable touches on a sprite to make it “tap through”?

I know that for traditional UIViews, I can set “enable user interaction” flag to NO, and the view will no longer respond to touches, letting the views below them receive touches.

Is there some way to implement the same “tap through” functionality in Sprite Kit? So far I’ve only seen people using “Touches began”, getting the point and asking the scene for nodes at that point.

  • Is there a way to open my application on a specific tab upon receiving a push notification?
  • IPA File Structure - SupportSwift & Symbols
  • Google Weather API gone?
  • equivalent to shared preferences in ios
  • Add iOS speech recognition support for web app?
  • rightBarButtonItem image not showing up
  • The problem with this approach is – if I want to add overlays on top of sprites (like monster life points, etc) they will also respond to touches. So far I’m trying to avoid this problem by creating custom classes for different nodes, and then having a very big if statement, checking the class of each node.

    Is there a better way to achieve “tap through” functionality for sprite kit?

    2 Solutions Collect From Internet About “iOS7 Sprite Kit how to disable touches on a sprite to make it “tap through”?”

    If you set the userInteractionEnabled property to YES on a subclassed SKSpriteNode, then the touch delegates will called within the class. Hence, you can handle the touch for the sprite within its class.

    However, by default, the userInteractionEnabled property is set to NO. Hence the touch on a sprite is, by default, a “tap through”.

    So, for the overlays you want, create custom classes for the sprites, implement the touchesBegan: and other delegates within that class and while initialising, set the userInteractionEnabled property to YES.

    Sprite Kit uses the zPosition value only to determine the hit testing and drawing order.

    So you could put all your sprites higher than 0 if you don’t want to hit them. And then so a simple logic test is zPostion>0