el.severo
el.severo

Reputation: 2287

cocos2d modal window with CCLayer

Trying to implement a modal window with CCLayer. My modal view layer is added as a child of another layer.

On my modal view layer I've added methods(the touch is enabled):

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

-(BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
    return YES;
}

Why the modal view layer it doesn't swallos my touches?

Upvotes: 2

Views: 660

Answers (1)

Igor Pchelko
Igor Pchelko

Reputation: 318

try to set priority to -129. Menu have lowest priority (kCCMenuTouchPriority = -128). Just try this code:

[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:-129 swallowsTouches:YES];

Upvotes: 2

Related Questions