0
votes

in my CCScene i am adding some UILable and UIPickerView they works great, but when i am trying then to add a CCMenu (cocos2d) i dont see it, or, that i can see something that cover my labels but not see the button itself.

code for the button :

CCMenuItemImage *back = [CCMenuItemImage itemFromNormalImage:@"openBack.png" selectedImage:@"openBack.png" target:self selector:@selector(setMenu:)];
    back.position=ccp(300,300);
    back.tag=30;
    CCMenu *menu = [CCMenu menuWithItems:back,nil];  
    [self addChild:menu  z:100]; 

and the other views of the UIKit i add with :

[[[[CCDirector sharedDirector] openGLView] window] addSubview:activationCode];

i cant figure out the connection between the openGL and the cocos CCScene. any help ?

2

2 Answers

0
votes

Everything you do in Cocos2D is placed into one UIView, assuming you're using it the way I am. This means that if you add a UIKit element later, it will appear either above or below everything you've done in Cocos2D. We can't interleave UIKit and Cocos2D elements in a complicated way.

0
votes

Cocos2d is a wrapper around xCode particularly for game development.So CCScene is an element of cocos2d but a UIView belongs to the xCode.You are placing everything over a view.

To make your menu visible, you can place the menu outside the view.Because you can specify the size of the view.Make the rect of the view smaller in such a way that you can get enough space to place the menu.

Or if you are moving on with a UIView with full screen size , then you have better options like UIButton which can be easily added on to the uiview.