横向きのみをサポートするレガシー アプリを iOS 6 にアップグレードしています。iPhone シミュレーターまたは iPhone 4 でアプリを実行すると、ルート ビュー コントローラーの向きが縦向きになり、横向きになるはずです。ただし、キーボードは最初は正しい位置にあります。さらに、デバイスを回転させると、キーボードが最初の向きに固定され、ルート ビューの向きが変わることはありません。
プロジェクト設定の [サポートされているインターフェイスの向き] セクションで、[Landscape Left] ボタンと [Landscape Right] ボタンが選択されています。pList ファイルでは、Landscape (右のホーム ボタン) が Initial Interface Orientation に設定され、Landscape (右のホーム ボタン) と Landscape (左のホーム ボタン) が Supported interface orientations に設定されています。
また、ルート ビュー コントローラーで、次のコードを置き換えました。
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
BOOL rotate = NO;
if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight)
rotate = YES;
return rotate;
}
このコードで:
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (BOOL)shouldAutorotate {
return YES;
}
何か案は?