Skip to content

Instantly share code, notes, and snippets.

@atsu666
Created November 16, 2012 12:08
Show Gist options
  • Save atsu666/4086788 to your computer and use it in GitHub Desktop.
Save atsu666/4086788 to your computer and use it in GitHub Desktop.
iPhoneとiPadの分離コード
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
// iPhone, iPod Touchの場合の動作
MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController_iPhone" bundle:nil] autorelease];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
self.window.rootViewController = self.navigationController;
} else {
// iPadの場合の動作
MasterViewController *masterViewController = [[[MasterViewController alloc] initWithNibName:@"MasterViewController_iPhone" bundle:nil] autorelease];
self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
self.window.rootViewController = self.navigationController;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment