2012-01-05 90 views
0

我有問題讓排行榜顯示。我想我有正確的,但我的日誌cocos2d,遊戲中心排行榜不工作

Unbalanced calls to begin/end appearance transitions for <UIViewController: 0x105e39c0>. 

在得到這個錯誤,這裏是我的代碼,以顯示和隱藏視圖

- (void)showLeaderboard 
{ 
    GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init]; 
    if (leaderboardController != NULL) 
    { CCLOG(@" leaderboardController ok..."); 
     tempVC = [[UIViewController alloc] init]; 
     leaderboardController.leaderboardDelegate = self; 
     [[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view]; 

     leaderboardController.category =  @"com.bluemesasoftware.housedefender.hightestscore"; 

    leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime; 
    leaderboardController.leaderboardDelegate = self; 
    [tempVC presentModalViewController: leaderboardController animated: YES]; 
} 
} 

- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController 
{ 
    [tempVC dismissModalViewControllerAnimated:YES]; 
    [tempVC.view.superview removeFromSuperview]; 
    [tempVC release]; 
} 
+0

我打算髮布一些東西,但我看到你固定pr這裏的任何其他人都是鏈接:http://www.cocos2d-iphone.org/forum/topic/28079 – CStreel 2012-01-08 04:26:17

回答

1
[tempVC presentModalViewController: leaderboardController animated: NO]; 

[tempVC dismissModalViewControllerAnimated:YES]; 

這應該工作。

0

認爲不會增加CCDirector的openglview

我假設你有這樣的代碼在你的AppDelegate ......如果這樣做:

[window.rootViewControler.view addSubview:tempVC.view]; 

,而不是

[[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view]; 

也..前移動此代碼presentModalViewController