2012-09-14 60 views
0

我顯示遊戲中心排行榜,但是當我點擊完成按鈕排行榜關閉。 但我無法點擊屏幕上的任何按鈕。當排行榜在遊戲中心關閉時,cocos2d攻絲被禁用

這裏我的代碼:

- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController 
{ 
    CCLOG(@"leaderboardViewControllerDidFinish %@", viewController); 
    [viewController dismissModalViewControllerAnimated:YES]; 
    [viewController.view removeFromSuperview]; 
    [viewController release]; 
    [[CCDirector sharedDirector] resume]; 
} 

回答

1

使用此代碼。

的Cocos2D 1.0

-(void) leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController 
{ 
    AppDelegate* app = (AppDelegate*)[[UIApplication sharedApplication] delegate]; 
    [app.viewController dismissModalViewControllerAnimated:YES]; 
} 
1

我使用cocos2D上1.0

對不起,您所提供的代碼不起作用的cocos2d 2.0

-(void) leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController 
{ 
    AppController *app = (AppController*) [[UIApplication sharedApplication] delegate]; 
    [app.navController dismissModalViewControllerAnimated:YES]; 
} 

我修復了這個問題。我只是評論一行。 我失去了排行榜的密切動畫,但它的工作。

- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController 
{ 
    CCLOG(@"leaderboardViewControllerDidFinish %@", viewController); 
    [viewController.view removeFromSuperview]; 
    [viewController release];  
    [[CCDirector sharedDirector] resume]; 
}