CCMenuItemSprite Not Responding To Touch in iOS8

121 views Asked by At

My Cocos2D app utilizes a number of CCMenuItemSprite's for buttons (e.g. back button). When the button is on the left half of a landscape scene, it fails to respond to the touch. The buttons on the right half of the screen work fine. The code to initialize the button is straight forward:

CCSprite *normalSprite = [CCSprite spriteWithFile:@"MenuArrowButtonOblongNormal_iPad.png"];
CCSprite *selectedSprite = [CCSprite spriteWithFile:@"MenuArrowButtonOblongSelected_iPad.png"];
CCMenuItemSprite *backButton = [CCMenuItemSprite itemFromNormalSprite:normalSprite
                                                       selectedSprite:selectedSprite
                                                               target:self
                                                             selector:@selector(returnToOptionsMenu)];

if (screenSizeInPixels.width == 1136.0f) {
        [backButton setScaleX:0.9375f];
        [backButton setScaleY:0.8322f];
        buttonHeight = 0.9f;
}

CCMenu *sceneSelectMenu;
sceneSelectMenu = [CCMenu menuWithItems: backButton,nil];
[sceneSelectMenu alignItemsVerticallyWithPadding:screenSize.height * 0.059f];
[sceneSelectMenu setPosition:ccp(screenSize.width*0.15, 
                                 screenSize.height * buttonHeight)];


[self addChild:sceneSelectMenu];

// And finally the back button label
CCLabelTTF *backButtonLabel;
backButtonLabel = [CCLabelTTF labelWithString:NSLocalizedString(@"Back", @"Enables user to exit the current screen and view the previous screen")
                                     fontName:@"Marker Felt"
                                     fontSize:scaledFontSize*1.3];
backButtonLabel.color = ccc3(255,255,255);
[backButtonLabel setAnchorPoint:ccp(0.5,0.5)];

backButtonLabel.position = ccp(screenSize.width * (0.14+labelOffset),
                               screenSize.height * labelHeight);
[self addChild:backButtonLabel z:2];

This is an older app that utilized Cocos2D version 1.1-RC0. I have made several updates to this code based on the suggested changes in iPhone 6 and 6+ update patch for cocos2d 2.1. But these primarily address resolution/scale factor issues.

If no one has seen this issue, can you suggest where in the cocos2D I might investigate to determine why the touches are not being detected/acted upon?

0

There are 0 answers