iDevGames Forums
skinning gamecenter UI - Printable Version

+- iDevGames Forums (
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Game Programming Fundamentals (/forum-7.html)
+--- Thread: skinning gamecenter UI (/thread-9256.html)

skinning gamecenter UI - sefiroths - Aug 10, 2011 06:25 AM

there is a way to implement a custom UI for the apple gamecenter?

RE: skinning gamecenter UI - Frank C. - Aug 10, 2011 10:42 AM

Yup. There are APIs to grab scores, achievements, user/friend info etc. So just ask GameKit for whatever data you want to display and draw it however you please. There are some limitations as too how much data you can pull at once so be sure to read the docs.

RE: skinning gamecenter UI - sefiroths - Aug 11, 2011 11:18 AM

thanks, i'll look.
any tuts on this however?

RE: skinning gamecenter UI - Frank C. - Aug 11, 2011 02:31 PM

I don't know of any tutorials but the docs show you how to grab data from Game Center:

There are a few Game Center WWDC videos that might be worth watching too:

RE: skinning gamecenter UI - sefiroths - Aug 15, 2011 03:00 AM

thanks for help, i'm running in a problem.

i have made a tableview to show players like leaderboard, however when i call [self loadView]; (code below) when i retrive top ten scores, loadview don't wait the end of loading request and the table results empty. the standard leaderboard has a UIActivityIndicatorView that not fills the table till finished. how can i implement a custom leaderboard?

- (void) retrieveTopTenScores
NSMutableArray *playerIDs=[NSMutableArray arrayWithCapacity:10];
NSMutableArray *nameArray=[NSMutableArray arrayWithCapacity:10];

GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];
if (leaderboardRequest != nil)
    leaderboardRequest.playerScope = GKLeaderboardPlayerScopeGlobal;
    leaderboardRequest.timeScope = GKLeaderboardTimeScopeAllTime;
    leaderboardRequest.range = NSMakeRange(1,10);

    [leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) {
        if (error != nil)
            // handle the error.
        if (scores != nil)
            // process the score information.
            NSString *myArrayString = [scores description];
            for (int i=0; i<[scores count]; i++)
                [playerIDs addObject:[[scores objectAtIndex:i] playerID]];


            [GKPlayer loadPlayersForIdentifiers:playerIDs withCompletionHandler:^(NSArray *players, NSError *error) {
                if (error != nil)
                    NSLog(@"error GKPlayer");
                    // Handle the error.
                if (players != nil)

                    for(int i = 0; i<[players count]; i++) {          
                        [nameArray addObject:[[players objectAtIndex:i]alias]];
                        rowText[i]=[NSString stringWithFormat:@"%@ %d", [[players objectAtIndex:i]alias],[[scores objectAtIndex:i] value]];
                    [self loadView];




- (void)loadView
CGRect frame = CGRectMake(257, 135, 205, 284);//[[UIScreen mainScreen] applicationFrame]
NSLog(@"%f %f %f %f",frame.origin.x,frame.origin.y,frame.size.width,frame.size.height);
leaderBoardTable = [[UITableView alloc] initWithFrame:frame style:UITableViewStylePlain];
//inappTable.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;
leaderBoardTable.delegate = self;
leaderBoardTable.dataSource = self;
[leaderBoardTable reloadData];

self.view = leaderBoardTable;
[leaderBoardTable release];

RE: skinning gamecenter UI - Frank C. - Aug 15, 2011 01:32 PM

I'm really not the guy to offer advice on UIKit, but I do know you don't want to call into UIKit from inside a block without first dispatching to the main queue/thread. And I'm almost certain you shouldn't be calling loadView.

Apple has a "GKTapper" example project that might help, or at least show what a convoluted mess you've gotten yourself into Wink

RE: skinning gamecenter UI - sefiroths - Aug 17, 2011 10:09 AM

thanks i'll try