我有这段代码用于在视图中显示排行榜
。H
UIViewController *presentingViewController;
{
@property (retain) UIViewController *presentingViewController;
.m
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[presentingViewController dismissModalViewControllerAnimated:YES];
[self.presentingViewController.view removeFromSuperview];
}
- (void)leaderboard
{
GKLeaderboardViewController *lb = [[GKLeaderboardViewController alloc] init];
if(lb != nil){
lb.leaderboardDelegate = self;
presentingViewController = [[UIViewController alloc] init];
[[[[CCDirector sharedDirector] openGLView] window] addSubview:presentingViewController.view];
[presentingViewController presentModalViewController:lb animated:YES];
}
一切都很好,它显示了排行榜,当我点击完成按钮时它会消失,但是我再次点击游戏中心按钮,排行榜没有出来,我们也无法浏览其他页面。
我上面的代码有什么问题,这是针对 iphone cocos2d 应用程序的
提前致谢。