Converting to a Universal App
I am beginning the process of turning Mach Dice into a universal app, as part of a big update that I’ve been working on. So far, it seems pretty straightforward:
- set the “Targeted Device Family” to “iPhone/iPad”
- create iPad versions of the xib files
- add the main xib file to Info.plist as “NSMainNibFile~ipad”
- add the other xib files to your code (see below)
- uprez your images
The last one is going to take me a while but adding the xib files to your code goes something like this:
// this gets declared somewhere at the top typedef enum { DisplayTypeIPhone, DisplayTypeIPhoneRetina, DisplayTypeIPad, } DisplayType; DisplayType displayType; ... // this gets run somewhere at the start // determine device type displayType = DisplayTypeIPhone; // check for iPad float systemVersion = [[UIDevice currentDevice].systemVersion floatValue]; if (systemVersion >= 3.2) if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) displayType = DisplayTypeIPad; // check for Retina Display if (systemVersion >= 4.0) if ([UIScreen mainScreen].scale == 2.0) displayType = DisplayTypeIPhoneRetina; ... // this gets run when you load your xib files switch (displayType) { case DisplayTypeIPad: gameViewController = [[GameViewController alloc] initWithNibName:@"GameViewController-iPad" bundle:nil]; break; case DisplayTypeIPhone: default: gameViewController = [[GameViewController alloc] initWithNibName:@"GameViewController" bundle:nil]; break;