当我在排行榜视图中按下完成按钮时,它不会执行任何操作并且排行榜仍然可见。
这是代码:
GKGameCenterViewController *gcViewController = [[GKGameCenterViewController alloc] init];
gcViewController.gameCenterDelegate = self;
[gcViewController setDelegate:self ];
if (shouldShowLeaderboard) {
gcViewController.viewState = GKGameCenterViewControllerStateLeaderboards;
gcViewController.leaderboardIdentifier = currentLeaderBoard;
}
else{
gcViewController.viewState = GKGameCenterViewControllerStateAchievements;
}
[self presentViewController:gcViewController animated:YES completion:nil];**
答案 0 :(得分:5)
你必须添加函数来关闭视图控制器(委托)
-(void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController{
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
}
答案 1 :(得分:0)
对我有用的是将GKGameCenterControllerDelegate
添加到协议列表中。