2

横向きのみをサポートするレガシー アプリを 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;

 }

何か案は?

4

1 に答える 1

1

以前のアプリをiOS6に更新するのと同じ状況でした。私の解決策については、その投稿を確認できます。

iOS6では回転の動作が異なります

要約すると、メインウィンドウのrootViewControllerプロパティを実装するカスタムナビゲーションコントローラーに設定してからshouldAutorotate、それを実行する必要がありsupportedInterfaceOrientationます。これは正しく機能するはずです。

于 2012-10-31T03:11:24.020 に答える