1

Xcode 4.5 で IOS 5 用の iPad アプリを作成すると、横向きの問題が発生します。

Bool autorotateインターフェイスビルダーでランドスケープを選択するだけのように、コードは使用しません。[自動レイアウトを使用] の選択が解除されています。

アプリを作成するときに、プロジェクト フォルダー (青いアイコン) で IOS Deployment Target 5.1 を選択します。

ここに画像の説明を入力

ビルド設定はアーキテクチャ ベース Sdk は IOS 6

ここに画像の説明を入力

ストーリーボードでは、ナビゲーション コントローラーが横向きに設定され、インターフェイス ドキュメントが 5.1 に設定されています。

ここに画像の説明を入力

IOS 6 シミュレータ ランドスケープでは、次のようにうまく機能します。

ここに画像の説明を入力

しかし、IOS 5.1 では、シミュレータ ランドスケープが機能せず、見当識障害があります。

ここに画像の説明を入力

何が欠けていますか?これを 5.1 と 6 の両方のバージョンで機能させるにはどうすればよいですか?

編集=====

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if (interfaceOrientation==UIInterfaceOrientationLandscapeRight)
        return YES;

    return NO;
}

上記のコードも機能しません。それは今でも同じです。

4

3 に答える 3

2

ビュー コントローラーで shouldAutorotateToInterfaceOrientation: をオーバーライドし、目的の方向に対して YES を返す必要があります。たとえば、

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight;

}

于 2012-11-20T17:14:55.703 に答える
1

IOS 6.0 より前では、プロジェクトのすべての ViewController でこのメソッドをオーバーライドする必要があります。IOS 6 では、ついに Apple はこの動作を修正しました

    -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

}

于 2012-11-20T17:21:57.803 に答える