pmk の提案に従って、次のことを行うよう拡張して提案します。
xib ファイルで、UIViewController のビュー以外に 2 つの異なるビューを作成します。そのうちの 1 つはポートレート モードで、もう 1 つはランドスケープ モードにする必要があります。
インターフェイス ファイルで 2 つの IBOutlet ビューを宣言し、上で説明したビューに接続します。
IBOutlet UIView *portraitView;
IBOutlet UIView *landscapeView;
ここで、実装ファイルで方向の変更を「認識する」必要があり、方向に応じて正しいものを設定します。あなたのviewDidLoadであなたは置くことができます:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];
そして最後に、次のようなものを実装します。
-(void)didRotate:(NSNotification *)notification
{
UIDeviceOrientation orientation = [[UIDevice currentDevice] orientation];
if (orientation == UIDeviceOrientationLandscape)
{
portraitView.hidden = YES;
landscapeView.hidden = NO;
}
else if (orientation == UIDeviceOrientationPortrait)
{
portraitView.hidden = NO;
landscapeView.hidden = YES;
}
}