A Better Approach

In the section, “Posting a Score,” earlier in this chapter, we discovered how to post new scores to Game Center. Our methodology, while simple, was not the best approach from a user-interaction standpoint. It is now time to refactor the posting new score code to improve usability. This approach is more complex, but delivers better performance and has less of an impact on the user.

The first thing we need to do is move our scoreReported method from UFOGameViewController to UFOViewController. We also want to modify the exit action in the UFOViewController. Modify that method to match the following.

-(IBAction)exitAction:(id)sender; {         [[self navigationController] popViewControllerAnimated: YES];         [self.gcManager ...

Get Beginning iOS Game Center and Game Kit: For iPhone, iPad, and iPod touch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.