質問

こんにちは私はこのコードを持っています...

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return YES;
}

- (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{

  if(UIInterfaceOrientationIsPortrait(interfaceOrientation)){
    // WTF, this runs when I change to Landscape
  } else {
    // this runs when I change to Portrait??? shouldn't it be the contrary?
  }
}

ご覧のとおり、コードは逆に実行されています。つまり、デバイスをポートレートに変更すると、コードのランドスケープ部分が実行され、その逆も同様です。

デバイスを回すと、self.viewが回転します。

このuiinterfaceorientationisportraitは、回転の前のインターフェイスの方法をテストしていますか、それとも何かが足りませんか?

助けてくれてありがとう。

役に立ちましたか?

解決

この方法はDidrotateという名前であることに注意してくださいからインターフェイス向上、当然のことです interfaceOrientation パラメーターには、新しい方向ではなく、古い方向が含まれています。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top