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];
精彩评论