views:

40

answers:

1

Hi,

Just want to know how to transition from a cocos2d scene to a UIviewcontroller view and vice-versa?

thanks, mark

A: 

Cocos2D lives in a view, specifically a EAGLView (a subclass of UIView) - that it creates.

Transitioning is not as cut and dry as it seems, especially if using one of the built in templates, cocos2d lives in a new UIWindow (that it creates in your "didFinishLaunchingWithOptions:launchOptions" function).

- You have to create a new view based application, and add cocos2d as a subview of that in order for it to work.

The structure would look like this:

UIViewController (A subclass you created)
 --View (iOS makes this by default for your UIViewController)
   -- CocosView (You make this using [UIView initWithFrame:] )
      -- EAGLView (CCDirector creates on init)
   -- Regular UIKit View ( You make this )
Onedayitwillmake
thanks for the advice:
Mark
I had to do the exact same thing, an i wrote about my process here (LINK SPAM DISCLAIMER i dunno what the policy is but yes this is a link to my own blog entry on steps towards accomplishing the above task) http://www.learningiphone.com/?p=187
Onedayitwillmake