Disable background userinteraction - Cocos2d

392 views Asked by At

I have a custom CCNode that I am using for providing notifications on a popup basis. I am trying to disable the background when the CCNode is popped up but allow user interaction on the new CCNode.

I can disable the parent UIView by using the following when the popup is called

[[[CCDirector sharedDirector] view] setUserInteractionEnabled:NO];

In the class for my custom CCNode notification I have the button set to the following to try and override the previous code so that the button is the only touchable event

_buttonOK.userInteractionEnabled = TRUE;

However this is not working and the whole view's user interaction is disabled. How would I override this to enable only the _buttonOK to be touchable?

1

There are 1 answers

0
Kalvin On BEST ANSWER

Thought it's not the prettiest way to do it, you can create a CCMenuItem with 100% width&height without any method. Everything under this CCMenuItem won't be clickable and you can add what you want as enabled on top of the CCMenuItem.

so... you would have something like:

Interaction Enabled Nodes > CCMenuItem without any method > Background without interaction.

Hope it helps :)