开发者

GameKitHelper: Displaying Game Center leaderboards

I am using GameKitHelper for my Cocos2d game. At some point, I will want to display the leaderboards, so I do this:

[[GameKitHelper sharedGameKitHelper] showLead开发者_Python百科erboard];

But nothing happens. What should I do?


Show gameKit helper? Its wrong..

it should be this:

- (void) showLeaderboard
{
    GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
    if (leaderboardController != nil)
    {
        leaderboardController.leaderboardDelegate = self;
        [self presentModalViewController: leaderboardController animated: YES];
    }
}

reference at this link: Link

The code for cocos2d..

UIViewController* _tmpView = [[UIViewController alloc] initWithNibName:nil bundle:nil];
    GKLeaderboardViewController* gclb = [[GKLeaderboardViewController alloc] init];
gclb.leaderboardDelegate = self;
    [[[CCDirector sharedDirector] openGLView] addSubview:_tmpView.view]; 
    [_tmpView presentModalViewController:gclb animated:NO];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜