私のアプリには iPhone 5 用の追加機能があり、そのための .xib を持つ別のクラスを作成しました。画面の高さを検出し (デバイス ID/モデルを取得できない場合)、それに応じて別のビュー コントローラーをロードしたいと思います。私はこれを試しました:
- (IBAction)select:(id)sender {
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
CGFloat screenHeight = screenRect.size.height;
if (screenHeight == 960) {
Selection *selectView =[[Selection alloc] initWithNibName:nil bundle:nil];
selectView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:selectView animated:YES];
}
else {
Selection_5 *selectView =[[Selection_5 alloc] initWithNibName:nil bundle:nil];
selectView.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:selectView animated:YES];
}
}
Selection と Selection_5 は 2 つの異なるクラスであり、それぞれユーザー インターフェイスの xib が異なります。