0

私のアプリケーションは常に横向きモードで起動し、左側にホーム ボタンがあります。右側のホームボタンなら回転。逆にするにはどうすればいいですか?キーのinfo.plistファイルに別の値を設定しようとしましinitial interface orientationたが、うまくいきませんでした。このメソッドで値の順序を切り替えてみました:

- (NSInteger)supportedInterfaceOrientations
{
  return UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskLandscapeLeft;
}

しかし、それもうまくいきませんでした。それ、どうやったら出来るの?

4

1 に答える 1

4

IOS 5 および 5.1 の場合:

ビューコントローラーを設定(BOOL)shouldAutorotateToInterfaceOrientationしてみてください。私にとってはうまくいきます。

ここに画像の説明を入力

ここに画像の説明を入力

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

ストーリーボードを使用している場合は、初期およびその他のビューコントローラーをランドスケープ モードに設定することもできます。

ここに画像の説明を入力

IOS 6 の場合:

あなた (NSInteger)supportedInterfaceOrientationsはそうあるべきです(NSUInteger)、私はそれを使用したことがありませんが、私にはわかりません。

// Only used by iOS 6 and newer.
- (BOOL)shouldAutorotate
{
    //returns true if want to allow orientation change
    return TRUE;

}
- (NSUInteger)supportedInterfaceOrientations
{   
     //decide number of origination to supported by Viewcontroller.
     return return UIInterfaceOrientationMaskLandscape;


}
于 2013-02-08T15:30:29.003 に答える