Alex
Alex

Reputation: 11137

call ccTouchesBegan even when i touch a ccMenuItem

I have a CCMenu with CCMenuItems that I add on a CCLayer. When I click on the CCMenuItems, my CCTouchesBegan doesn't fire up.

How can I call this method also when I touch my menu items?

Upvotes: 2

Views: 668

Answers (1)

Morion
Morion

Reputation: 10860

CCMenu registers as targeted touch delegate and swallows touches on menu items. You can try to create your subclass of CCMenu and override it registerWithTouchDispatcher method like this

-(void) registerWithTouchDispatcher
{
    [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:kCCMenuTouchPriority swallowsTouches:NO];
}

This should work as you want, but maybe can cause other problems with menu behavior.

Upvotes: 2

Related Questions