0

我是 cocos2dx 的基础。我正在使用“UIviewcontroller”如下

-(void)showLeaderBoar:(NSString*) category
{
GKLeaderboardViewController *leaderboad=[[GKLeaderboardViewController alloc] init];
   if(leaderboad!=nil)
   {
       UIWindow *window=[[UIApplication sharedApplication]keyWindow];
       UIViewController * currentModalViewController=[[UIViewController alloc]init];
      [window addSubview:currentModalViewController.view];
      leaderboad.category=category;
       leaderboad.timeScope=GKLeaderboardTimeScopeAllTime;
       leaderboad.leaderboardDelegate=self;
       [[LeaderBoardManager sharedManager] reportScore:10000 forCategory:category];

       [currentModalViewController presentModalViewController:leaderboad animated:YES];
    }
[leaderboad release];
}

-(void) leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{

  [viewController dismissModalViewControllerAnimated:YES];  
   [viewController release];

}

当我第一次运行并单击排行榜按钮时,我可以获得,但下次我单击时,我无法调用此函数。谁能指出我的错误?谢谢你的建议。

4

1 回答 1

0

尝试这个:

    self.modalPresentationStyle = UIModalPresentationCurrentContext;

此外,考虑从不同的视图控制器呈现它。

于 2013-05-06T17:19:17.560 回答