0

我显示了游戏中心排行榜,但是当我点击完成按钮时,排行榜关闭。但我无法点击屏幕上的任何按钮。

这是我的代码:

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

2 回答 2

1

使用此代码。

Cocos2D 2.0

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

Cocos2D 1.0

-(void) leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
    AppDelegate* app = (AppDelegate*)[[UIApplication sharedApplication] delegate];
    [app.viewController dismissModalViewControllerAnimated:YES];
}
于 2012-09-14T16:55:00.937 回答
1

我正在使用 cocos2D 1.0

很抱歉,您提供的代码不起作用。

我解决了这个问题。我只评论一行。我失去了排行榜的关闭动画,但它的工作。

- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
    CCLOG(@"leaderboardViewControllerDidFinish %@", viewController);
    [viewController.view removeFromSuperview];
    [viewController release];    
    [[CCDirector sharedDirector] resume];
}
于 2012-09-14T17:46:12.590 回答