我在我的Cocos2d游戏中使用GameKitHelper。在某些时候,我会想要显示排行榜,所以我这样做:
[[GameKitHelper sharedGameKitHelper] showLeaderboard];
但没有任何反应。我该怎么办?
答案 0 :(得分:5)
显示gameKit助手?错了..
它应该是这样的:
- (void) showLeaderboard
{
GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != nil)
{
leaderboardController.leaderboardDelegate = self;
[self presentModalViewController: leaderboardController animated: YES];
}
}
此链接的引用:Link
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];