mono/MonoGame — pull request #2504 by picobots (2014-05-09 17:22:29+00:00)
Title: Game Center/Guide overhaul for iOS 6+

Partially overhauled the Guide for iOS 6+ Game Center functionality.

#### Encapsulated repetitious code into single-purpose methods

Instead of this type code being repeated all over the file:

```c#
if (_window != null)
{
if(viewController == null)
{
viewController = new GuideViewController(_gameViewController);
_window.Add(viewController.View);
viewController.View.Hidden = true;
}

prevGestures=TouchPanel.EnabledGestures;
TouchPanel.EnabledGestures=GestureType.None;
viewController.PresentModalViewController(leaderboardController, true);
IsVisible = true;
}
```

Everything for showing and hiding Game Center view controllers is now encapsulated into two reusable and easily testable methods, which correctly handle the different modes of presenting/dismissing controllers for iOS 5 vs. iOS 6+:

```c#
private static void ShowViewController(UIViewController viewController)
{
// ...
}

private static void HideViewController(UIViewController viewController)
{
// ...
}
```

#### Fixed runtime warnings for Game Center in iOS 7

Using a separate `GuideViewController` as a parent for Game Center view controllers generates runtime warnings in iOS 6+. The new "correct" way to open Game Center view controllers is to simply open them with the root view controller (as seen in the new `ShowViewController` method mentioned above).

#### iOS 6+ no longer uses deprecated methods to open Game Center windows

Instead of using the deprecated `GKLeaderboardViewController` and `GKAchievementViewController`, iOS 6+ now uses the new `GKGameCenterViewController` for showing leaderboards and achievements. As with everything else, the old methods are still in place for iOS 5 and older. Related note: All compiler warnings in Guide.cs have been fixed.

#### Fixed a MatchMaker crash bug

Setting playersToInvite to null caused the game to crash, so now we pass in an empty array instead which seems to work well (tested on iOS 5+).

#### Fixed the file formatting

Tabs, spaces, braces in Guide.cs have been fixed to be in line with MonoGame's coding conventions.

#### Bonus feature: Twitter

Added access to iOS's Twitter API in the Guide now too.