iPhone-インターフェイスの向きが逆転しましたか?
-
21-09-2019 - |
質問
こんにちは私はこのコードを持っています...
- (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
パラメーターには、新しい方向ではなく、古い方向が含まれています。
所属していません StackOverflow