Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Yes, this can be done.… – Gob00st Jan 4 '12 at 17:19

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];
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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