游戏中心“完成”按钮不起作用
我正在显示游戏中心排行榜,但它出现后我无法将其关闭 - “完成”按钮不起作用。
这是我的 RootViewController.m 代码:
-(void) showLeaderboard {
GKLeaderboardViewController *leaderboardVC [GKLeaderboardViewController alloc] init] autorelease];
if (leaderboardVC != nil) {
[leaderboardVC setDelegate: self];
[leaderboardVC setCategory: kLeaderboardID];
[leaderboardVC setTimeScope: GKLeaderboardTimeScopeWeek];
[self presentModalViewControllerAnimated: YES];
}
}
-(void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
NSLog(@"Close leaderboard");
[self dismissModalViewControllerAnimated: YES];
}
同样奇怪的是我从未在日志中看到“关闭排行榜”。
I am showing a Game Center Leaderboard but after it appears I can't close it—the "Done" button doesn't work.
Here is my code for RootViewController.m:
-(void) showLeaderboard {
GKLeaderboardViewController *leaderboardVC [GKLeaderboardViewController alloc] init] autorelease];
if (leaderboardVC != nil) {
[leaderboardVC setDelegate: self];
[leaderboardVC setCategory: kLeaderboardID];
[leaderboardVC setTimeScope: GKLeaderboardTimeScopeWeek];
[self presentModalViewControllerAnimated: YES];
}
}
-(void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
NSLog(@"Close leaderboard");
[self dismissModalViewControllerAnimated: YES];
}
What's also strange is that I never see "Close leaderboard" in the log.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否将 GKLeaderboardViewControllerDelegate 添加到此类实现的协议列表中? (leaderboardViewControllerDidFinish 是此协议中的唯一方法)。你的代码看起来很完美,所以这是我唯一能想到的。
Did you add GKLeaderboardViewControllerDelegate to the list of protocols that this class implements? (leaderboardViewControllerDidFinish is the only method in this protocol). Your code looks perfect so this is the only thing I can think of.