So, I am adding CCMenuItemImage to my layer, for example:
CCMenuItemImage *pauseButton = [CCMenuItemImage itemFromNormalImage:@"pausebutton.png"
selectedImage:@"pausebutton.png"
disabledImage:@"pausebutton.png"
target:self
selector:@selector(pauseGame:)];
pauseButton.position = ccp(24, 292);
[self addChild:pauseButton];
The problem is my pauseGame: the selector never fires when I touch the pause button!
I checked that the selector is set correctly by executing [pauseButton activate] (invokes the selector).
In addition, I confirmed that my layer responds to touches by displaying registration information in ccTouchesBegan and ccTouchesEnded.
It is also worth noting that I have sprites in my layer that are registered for such touches:
- (void) onEnter
{
[[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:YES];
[super onEnter];
}
What is the problem?
source
share