いつものように UIViewController のサブクラスがあります。アプリをロードするとき、プログラムで配置する必要があるいくつかの要素のサイズを調整する必要があります。もちろん、サイズはインターフェイスの向きによって異なります。
- (void)viewDidLoad {
switch( [self interfaceOrientation] ) {
case UIInterfaceOrientationPortrait:
case UIInterfaceOrientationPortraitUpsideDown:
NSLog(@"Portrait");
break:
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
NSLog(@"Landscape");
break;
}
ただし、シミュレーター/デバイスの向きに関係なく、すべてが正しく回転しても、ケースは常に viewDidLoad/WillAppear で縦になります。Plist に、サポートされているすべての向きを追加しました。ヒント?