2

ユーザーがデバイスを回転できるようにすることを計画していますが、起動時に、アプリを横向きモードから開始したいと考えています。どうすればそれを行うことができますか?

これがオリエンテーション用の私のコードです

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}
4

2 に答える 2

2

You need to check the orientation of the status bar.

Please check the following links :-

Force iOS app to launch in landscape mode

Modal View Controller force Landscape orientation in iOS 6

Force Landscape Orientation on iOS 6 in Objective-C

于 2013-05-23T14:47:48.020 に答える
1

プロジェクト設定/ターゲット設定 (xcode では左側のナビゲーション バーの上部にある青いアイコン) には、方向を指定するための設定があります。4 つの画像が表示され、それぞれを選択または選択解除できます。最初にアプリに必要なものだけを選択してから、 メソッドshouldAutorotatesupportedInterfaceOrientationメソッドを使用して、特定の向きを許可または禁止できます。
サポートされているインターフェイスの向きも plist で指定されています。plist ファイル内のそのサポートされたInterfaceOrientations リストの一番上にあるアプリの初期方向を維持するようにします。

于 2013-05-23T19:40:56.713 に答える