I have write the code like bellow
- (void)leaderboard {
GKLeaderboardViewController *leaderboardController = [[[GKLeaderboardViewController alloc] init] autorelease];
currentLeaderBoard = kLeaderboardID;
if (leaderboardController != NULL)
{
leaderboardController.leaderboardDelegate = self;
leaderboardController.category = currentLeaderBoard;
leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
tempVC = [[UIViewController alloc] init];
[[[[CCDirector sharedDirector] openGLView] window] addSubview:tempVC.view];
[tempVC presentModalViewController:leaderboardController animated:YES];
}
}
- (void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController *)viewController
{
[viewController dismissModalViewControllerAnimated:YES];
[viewController release];
}
警告如下:
Assigning to id<GKLeaderboardViewControllerDelegate> from incompatible type HelloWorldLayer *
记录还显示:
warning: class HelloWorldLayer does not implement the GKLeaderboardViewControllerDelegate protocol
I count find out why it is. and even when the game center leader board goes out then the menu becomes disable. I count continue with the game everything becomes disable.
sorry for the post editing i have solved the second part of the problem by myself. I have shifted the leaderboard view in another view.