cocos2d iphone - UIButton of previous scene overlaps CCSprite -


i have uibutton moves around randomly on screen. on clicking on button, new scene loaded that, now, contains ccsprite. here code:

//in init ccsprite *a = [ccsprite spritewithfile:@"a.png"]; [a setposition:ccp(0,0)]; [self addchild:a]; 

pretty straightforward, , stumps me why after 'replacescene' uibutton of thehelloworldscene.m still visible, right on top of sprite. going wrong?

i'm assuming since you're adding uibutton cocos2d scene you're using openglview like:

[[[ccdirector shareddirector] openglview] addsubview:button];

if case, before replace helloworldscene you'll need call similar to

[button removefromsuperview]

where button name of uibutton (in both instances).

a suggestion though use ccmenu ccmenuitem on helloworldscene uikit objects don't mesh cocos2d.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -