skinning gamecenter UI

Member
Posts: 164
Joined: 2010.10
Post: #1
there is a way to implement a custom UI for the apple gamecenter?
Quote this message in a reply
Member
Posts: 440
Joined: 2002.09
Post: #2
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.
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #3
thanks, i'll look.
any tuts on this however?
Quote this message in a reply
Member
Posts: 440
Joined: 2002.09
Post: #4
I don't know of any tutorials but the docs show you how to grab data from Game Center:
http://developer.apple.com/library/ios/#...ction.html

There are a few Game Center WWDC videos that might be worth watching too:
http://developer.apple.com/videos/
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #5
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?

Code:
- (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]];

            NSLog(@"%@",myArrayString);


            [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]];
                        NSLog(@"%@",rowText[i]);
                    }
                    NSLog(@"%@",nameArray);
                    [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];
}
Quote this message in a reply
Member
Posts: 440
Joined: 2002.09
Post: #6
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
Quote this message in a reply
Member
Posts: 164
Joined: 2010.10
Post: #7
thanks i'll try
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  gamecenter hidden achievement is visible sefiroths 0 1,753 Nov 7, 2012 12:20 PM
Last Post: sefiroths
  customize an action of iphone home button to submit score in gamecenter sefiroths 7 7,048 Nov 30, 2011 01:59 AM
Last Post: sefiroths