Reputation: 1837
Adding another uppper layer in cocos2d still touchable background layer. How to disable background layer just like pause screen. Here is how i am trying to do:
GamePauseLayer *pGamePauseLayer = [GamePauseLayer node];
[self addChild:pGamePauseLayer z:50];
z is higher than previous layer and other UI components. Please suggest any solution.
Upvotes: 0
Views: 865
Reputation: 21808
I think this should help. In your GamePauseLayer
's onEnter
method write the following:
[[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:257 swallowsTouches:YES];
and in onExit
:
[[[CCDirector sharedDirector] touchDispatcher] removeDelegate:self];
Upvotes: 1