I want to build a sprite based game using cocos2d. I will be mostly drawing everything in code. I also want to incorporate iPhone UI widgets such as buttons and such. Can these be created to appear on top of the cocos2d canvas? Will this affect the performance of what is drawn/animated?


1 Answer 1


You can get the reference to opengl view with: [[CCDirector sharedDirector] openGLView]

With that any UIView's can be added as subview of that opengl view as follows:

UIButton *myButton;
//initialise myButton here

[[[CCDirector sharedDirector] openGLView] addSubView:myButton];

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .