Note that there are some explanatory texts on larger screens.

plurals
  1. POCCMenu doesnt work in iPad
    primarykey
    data
    text
    <p>I'm creating an universal application and my CCMenu appears just fine on both iPhone, iPhone 4 and iPad. However the buttons do nothing when touched on the iPad.</p> <p>I have no specific iPad code other than modifying the contentScaling property so that the iPad uses the same images as the iPhone 4. This means that the same images work on iPhone 4 but not on the iPad.</p> <p>I am using cocos2d 0.99.rc0 and the iOS 4.1 SDK. I don't even know where to start troubleshooting this.</p> <p>The only oddity i noticed recently is that the iPad seems to draw the menu scene once, then quickly redraws it for some reason, moving everything one pixel or something. My menu class is very simple and has no "refreshing" code or anything that is supposed to move. This doesnt happen on either low or high res iPhones.</p> <p>Here is my code, sloppy but yet very simple.</p> <p>MainMenu.m:</p> <pre><code> CCMenuItemImage * playItem = [self makeMenuButtonWithSprite:@"Play.png" withSelector:@selector(play:)]; CCMenuItemImage * resumeItem = [self makeMenuButtonWithSprite:@"Resume.png" withSelector:@selector(resume:)]; CCMenuItemImage * optionsItem = [self makeMenuButtonWithSprite:@"Options.png" withSelector:@selector(options:)]; CCMenuItemImage * helpItem = [self makeMenuButtonWithSprite:@"Help.png" withSelector:@selector(help:)]; CCMenu *myMenu; // Check if there is a valid savegame by comparing versions. if ([[uD stringForKey:@"CFBundleVersion"] isEqualToString:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] ) { myMenu = [CCMenu menuWithItems:playItem, resumeItem, optionsItem, helpItem, nil]; } else { myMenu = [CCMenu menuWithItems:playItem, optionsItem, helpItem, nil]; } // Arrange the menu items vertically [myMenu alignItemsVerticallyWithPadding:0.0f]; myMenu.position = ccp(dB.wWidth/2,dB.wHeight/2); // add the menu to your scene [self addChild:myMenu z:100]; </code></pre> <p>And the CCMenuItemImage factory:</p> <pre><code>- (CCMenuItemImage *)makeMenuButtonWithSprite:(NSString *)spriteFileName withSelector:(SEL)selector { CCSprite *spriteForButton = [CCSprite spriteWithFile:spriteFileName]; spriteForButton.anchorPoint = ccp(0.5f,0.5f); CCMenuItemImage * buttonImage =[CCMenuItemImage itemFromNormalImage:@"button.png" selectedImage: @"button.png" target:self selector:selector]; [buttonImage addChild:spriteForButton z:100]; spriteForButton.position = ccp([buttonImage boundingBox].size.width/2,([buttonImage boundingBox].size.height/2)-5); return buttonImage; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload