我写了像bellow
这样的代码 - (void)leaderboard {
GKLeaderboardViewController *leaderboardController = [[[GKLeaderboardViewController alloc] init] autorelease];
currentLeaderBoard = kLeaderboardID;
if (leaderboardController != NULL)
{
leaderboardController.leaderboardDelegate = self;
leaderboardController.category = currentLeaderBoard;
leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
tempVC = [[UIViewController alloc] init];
[[[[CCDirector sharedDirector] openGLView] window] addSubview:tempVC.view];
[tempVC presentModalViewController:leaderboardController animated:YES];
}
}
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[viewController dismissModalViewControllerAnimated:YES];
[viewController release];
}
发出如下警告:
Assigning to 'id<GKLeaderboardViewControllerDelegate>' from incompatible type 'HelloWorldLayer *'
它还显示在日志视图中:
warning: class 'HelloWorldLayer' does not implement the 'GKLeaderboardViewControllerDelegate' protocol
我知道为什么会这样。即使游戏中心排行榜熄灭,菜单也会被禁用。 我继续计算游戏,一切都变得禁用。
抱歉编辑后,我已经解决了问题的第二部分。 我已在另一个视图中移动了排行榜视图。答案 0 :(得分:0)
您应该转到类接口并将GKLeaderboardViewControllerDelegate添加到已实现协议的列表中:
@interface HelloWorldLayer : CCLayer <GKLeaderboardViewControllerDelegate>
我无法理解的其余问题,你能解释一下吗?