我有一個奇怪的問題,只發生在我的遊戲的iPad版本。當我調出GameCenter排行榜時,它看起來很平常。那裏沒有問題。但是當您點擊關閉按鈕時,排行榜消失,並且cocos2d場景變黑。沒有錯誤,沒有。我沒有做任何事情可以將屏幕恢復。我試圖恢復導演,甚至在類似的線程上嘗試了一些解決方案。cocos2d GameCenter排行榜解僱後場景變黑
這是我在cocos2d場景中的代碼。 GCController只是RootViewController的一個子類,沒什麼特別的:
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];
}
任何有什麼想法?如果我可以提供更多信息,請告訴我。謝謝。
描述與代碼。 –
上面描述的代碼意味着有問題,我確實只在語句temvc.view.Superview中更改爲tempvc.view –