只需導入你的cocos2d layer.h和layer.m文件 並從視圖控制器使用調用下面的代碼: -
if(! [CCDirector setDirectorType:kCCDirectorTypeDisplayLink])
[CCDirector setDirectorType:kCCDirectorTypeDefault];
CCDirector *director = [CCDirector sharedDirector];
EAGLView *glView = [EAGLView viewWithFrame:[self.view bounds]
pixelFormat:kEAGLColorFormatRGB565 depthFormat:0];
[director setOpenGLView:glView];
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
[director setAnimationInterval:1.0/60];
[director setDisplayFPS:YES];
[self setView:glView];
[CCTexture2D setDefaultAlphaPixelFormat:kCCTexture2DPixelFormat_RGBA8888];
[[CCDirector sharedDirector] runWithScene: [HelloWorldLayer scene]];
你嘗試設置控制器在啓動時創建的openglview看法? – giorashc
你的意思,而不是設置navController與根主任,並調用與setview的導演:glview我可以做我的自定義視圖控制器相同? – Adarkuccio
從來沒有嘗試過,但你可以給它一個鏡頭。 – giorashc