Instead of presenting the view controller to container :
UIViewController *container = [[UIViewController alloc] init]; ... [container presentViewController:navController animated:YES completion:nil];
what should work presents it on the root view controller, the cocos2D template created for you. It is usually available through the application delegate:
UIViewController *rootViewController = (UIViewController*)[(YOURAPPDELEGATE*)[[UIApplication sharedApplication] delegate] viewController]; [rootViewController presentViewController:navController animated:YES completion:nil];
viewController is ivar that the default cocos2D template adds an application delegation class. It is usually private, so you need to define an accessor:
@property (nonatomic, readonly) RootViewController *viewController;
Hope this helps.
EDIT:
Based on what I have in my application, I think you can try and create an instance of RootViewController as follows:
CC_DIRECTOR_INIT ViewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; ViewController.wantsFullScreenLayout = YES; [ViewController setView:[[CCDirector sharedDirector] openGLView]]; ...
source share