2014-07-20 129 views
3

當我按排行榜視圖中的完成按鈕,它不會做任何事情,排行榜仍然可見。完成按鈕在遊戲中心排行榜不起作用

這裏是代碼:

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];** 

回答

5

必須添加功能駁回視圖控制器(委託)

-(void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController{ 
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil]; 

}

+0

非常感謝您!它工作完美。 – user3695947