Uiview GK排行榜旋转父视图控制器
我试图在另一个包含EAGL视图的视图控制器上显示一个GKLeadsboardViewController。视图显示良好,但将父视图逆时针旋转90度,以及断开父视图控制器的触摸响应和其他功能。GKLeaderboardViewController也会被罚款。以下是用于创建父视图的代码:Uiview GK排行榜旋转父视图控制器,uiview,cocos2d-iphone,ios6,gamekit,Uiview,Cocos2d Iphone,Ios6,Gamekit,我试图在另一个包含EAGL视图的视图控制器上显示一个GKLeadsboardViewController。视图显示良好,但将父视图逆时针旋转90度,以及断开父视图控制器的触摸响应和其他功能。GKLeaderboardViewController也会被罚款。以下是用于创建父视图的代码: viewController = [[RootViewController alloc]init]; viewController.wantsFullScreenLayout = YES; // // C
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];
}];
}
game center显示的通知自身方向正确,不会干扰EagleView,但排行榜视图会。有没有办法解决这个问题?升级到iOS 6后出现此问题 你的cocos2d版本号是多少?我已经修好了。他们在最新版本的cocos2d中解决了这个问题。我将shouldAutorotateToInterfaceOrientation替换为shouldAutorotate,并使用[[UIDevice currentDevice]方向]获取当前旋转。我还对支持的接口方向进行了编码,并返回UIInterfaceOrientationMaskAllButUpsideDown。