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?


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];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.