Game Development Reference
In-Depth Information
{
...
}
Then you must implement the leaderboardViewControllerDidFinish
method, used to simply dismiss the view and to forward the event to the delegate:
-(void) leaderboardViewControllerDidFinish:(GKLeaderboardViewController*)viewController
{
[self dismissModalViewController];
if ([delegate respondsToSelector:@selector(onLeaderboardViewDismissed)])
{
[delegate onLeaderboardViewDismissed];
}
}
Now there's a bit of behind-the-scenes magic going on. I've added a few helper meth-
ods to GameKitHelper that deal specifically with presenting and dismissing the
various Game Kit view controllers making use of the UINavigationController
instance cocos2d sets up in the AppController class. This navigation controller
will be used to display the Game Center views, as shown in Listing 14-12 .
Listing 14-12 . Using Cocos2d's Root View Controller to Present and Dismiss Game
Kit Views
#import "AppDelegate.h"
...
-(UINavigationController*) appNavigationController
{
AppController* app = (AppController*)[UIApplication sharedApplication].delegate;
return app.navController;
}
-(void) presentViewController:(UIViewController*)vc
{
UINavigationController* navController = [self appNavigationController];
 
 
Search Nedrilad ::




Custom Search