Skip to content

Instantly share code, notes, and snippets.

@codesburner
Forked from nolim1t/gist:374766
Created November 16, 2010 09:41
Show Gist options
  • Save codesburner/701630 to your computer and use it in GitHub Desktop.
Save codesburner/701630 to your computer and use it in GitHub Desktop.
// How to make a universal binary
// Step 1: Create an iPhone project
// Step 2: Go into Target Settings and set arch to arm6 and arm7
// Step 3: Set base SDK to 3.1.3 and under the deployment tab set device family to iPhone/iPad
// Step 4: Create an iPad NIB from an existing NIB and then add the following code to load a different NIB if you set the deployment version to iPhone SDK 3.2 (To target the iPhone you need to use 3.1.3)
// Settings notes
// Base SDK = iphone devise 3.2
// Target Devise Family = iPhone/iPad
// iPhone OS Deployment Target = iphone devise 3.1.3
///////////////////////////
// The code
///////////////////////////
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 30200
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
viewController = [[universalapptestViewController alloc] initWithNibName:@"universalapptestViewController-iPad" bundle:nil];
NSLog(@"iPad Loading the iPad UI");
} else {
// Show the iPhone UI if not an iPad
NSLog(@"hmmm.. looks like an iPhone");
viewController = [[universalapptestViewController alloc] initWithNibName:@"universalapptestViewController" bundle:nil];
}
#else
// < OS 3.2
viewController = [[universalapptestViewController alloc] initWithNibName:@"universalapptestViewController" bundle:nil];
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment