我正在尝试在另一个包含 EAGL 视图的视图控制器上显示 GKLeaderboardViewController。该视图呈现良好,但将父视图逆时针旋转 90 度,并破坏了父视图控制器的触摸响应和其他功能。GKLeaderboardViewController 也被解雇了。以下是用于创建父视图的代码:
viewController = [[RootViewController alloc]init];
viewController.wantsFullScreenLayout = YES;
//
// Create the EAGLView manually
// 1. Create a RGB565 format. Alternative: RGBA8
// 2. depth format of 0 bit. Use 16 or 24 bit for 3d effects, like CCPageTurnTransition
//
//
EAGLView *glView = [EAGLView viewWithFrame:[window bounds]
pixelFormat:kEAGLColorFormatRGB565 // kEAGLColorFormatRGBA8
depthFormat:0 // GL_DEPTH_COMPONENT16_OES
];
// attach the openglView to the director
glView.multipleTouchEnabled = YES;
[director setOpenGLView:glView];
// // Enables High Res mode (Retina Display) on iPhone 4 and maintains low res on all other devices
// if( ! [director enableRetinaDisplay:YES] )
// CCLOG(@"Retina Display Not supported");
//
// VERY IMPORTANT:
// If the rotation is going to be controlled by a UIViewController
// then the device orientation should be "Portrait".
//
// IMPORTANT:
// By default, this template only supports Landscape orientations.
// Edit the RootViewController.m file to edit the supported orientations.
//
//#ifdef _ARM_NEON_
//#define ARCH_OPTIMAL_PARTICLE_SYSTEM CCQuadParticleSystem //used to be CCQuadParticleSystem
//#elif _ARM_|| TARGET_IPHONE_SIMULATOR
//#define ARCH_OPTIMAL_PARTICLE_SYSTEM CCPointParticleSystem
//#else
//#error(unknown architecture)
//#endif
[director setAnimationInterval:1.0/60];
[director setDisplayFPS:NO];
[viewController.view addSubview:glView];
[viewController.view sendSubviewToBack:glView];
[window addSubview:viewController.view];
[window setRootViewController:viewController];
[[ZGCGKHelper sharedGameKitHelper]setViewController:viewController];
[window makeKeyAndVisible];
我正在展示排行榜视图,如下所示:
-(void) presentViewController:(UIViewController*)vc
{
UIViewController* rootVC = [self getRootViewController];
[[CCDirector sharedDirector] stopAnimation];
[rootVC presentViewController:vc animated:YES completion:^(void){
[[CCDirector sharedDirector] startAnimation];
}];
}
游戏中心显示的通知会正确定向并且不会干扰 EAGLView,但排行榜视图会干扰。有想法该怎么解决这个吗?升级到 iOS 6 后出现此问题。