Iphone 在GameCenter排行榜解散后,cocos2d场景变黑
我有一个奇怪的问题,只发生在我的游戏的iPad版本上。当我打开GameCenter排行榜时,它看起来很正常。没有问题。但当您点击关闭按钮时,引导板消失,cocos2d场景变为黑色。没有错误,什么都没有。我所做的一切都不能使屏幕恢复。我试着让导演复职,甚至在类似的问题上尝试了一些解决方案 这是我在cocos2d场景中的代码。GCController只是RootViewController的一个子类,没有什么特别之处:Iphone 在GameCenter排行榜解散后,cocos2d场景变黑,iphone,uiviewcontroller,cocos2d-iphone,game-center,Iphone,Uiviewcontroller,Cocos2d Iphone,Game Center,我有一个奇怪的问题,只发生在我的游戏的iPad版本上。当我打开GameCenter排行榜时,它看起来很正常。没有问题。但当您点击关闭按钮时,引导板消失,cocos2d场景变为黑色。没有错误,什么都没有。我所做的一切都不能使屏幕恢复。我试着让导演复职,甚至在类似的问题上尝试了一些解决方案 这是我在cocos2d场景中的代码。GCController只是RootViewController的一个子类,没有什么特别之处: tempVC = [[GCController alloc] init]; G
tempVC = [[GCController alloc] init];
GKLeaderboardViewController *leaderboardController = [[[GKLeaderboardViewController alloc] init] autorelease];
if (leaderboardController != nil)
{
leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
leaderboardController.category = [NSString stringWithFormat:@"%@%@", [self cleanString:selectedSong], @"TotalHD"];
leaderboardController.leaderboardDelegate = self;
[[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view];
[tempVC presentModalViewController:leaderboardController animated:YES];
}
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[tempVC dismissModalViewControllerAnimated:YES];
[tempVC.view.superview removeFromSuperview];
[tempVC release];
}
有人有什么想法吗?如果我能提供更多信息,请告诉我。谢谢。您没有提供足够的代码。我看不出你现在显示的代码有任何错误。黑屏最可能的原因(取决于您的操作方式)是计时器被中断,您可能需要使用
- (void) onEnter;
或
如果不是这样,那么发布更多的代码,我会回来查看。我们需要看到视图何时呈现以及它应该返回到什么位置
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[tempVC dismissModalViewControllerAnimated:YES];
上面描述的代码意味着我只将语句temvc.view.Superview更改为temvc.view
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[tempVC dismissModalViewControllerAnimated:YES];
**[tempVC.view removeFromSuperview];**
}