iOSユニバーサルアプリ
概要
ユニバーサルアプリは、iPhoneとiPad向けに単一のバイナリファイルで設計されたアプリケーションです。これによりコードの再利用が可能になり、更新をより迅速に行うことができます。
実例の手順
1、シンプルなView based application(ビューアプリケーション)を作成します
2、ファイルビューアの右側で、ファイルViewController.xibのファイル名をViewController_iPhone.xibに変更します(下記参照)

3、「File -> New -> File...」を選択し、次に「User Interface」を選択し、「View」を選択して、「Next」をクリックします

4、デバイスとしてiPadを選択し、「Next」をクリックします:

5、このファイルをViewController_iPad.xibとして保存し、「Create」を選択します
6、ViewController_iPhone.xibとViewController_iPad.xibの画面中央にラベルを追加します
7、ViewController_iPhone.xibで「Identity Inspector」を選択し、カスタムクラスを「ViewController」に設定します

8、AppDelegate.mのapplication:DidFinishLaunching:withOptionsメソッドを更新します
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen
mainScreen] bounds]];
// Override point for customization after application launch.
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) {
self.viewController = [[ViewController alloc]
initWithNibName:@"ViewController_iPhone" bundle:nil];
}
else{
self.viewController = [[ViewController alloc] initWithNibName:
@"ViewController_iPad" bundle:nil];
}
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
9、プロジェクトサマリーで「Devices」を「universal」に更新します(下記参照):

出力
そのアプリケーションを実行すると、以下の出力が表示されます

iPadシミュレーターでアプリケーションを実行すると、以下の出力が得られます:
