iOS でデバイスの向きを検出する方法について質問があります。変更通知を受け取る必要はありません。現在のオリエンテーション自体だけです。これはかなり単純な質問のようですが、頭を包むことができませんでした。以下は私がこれまでに行ったことです:
UIDevice *myDevice = [UIDevice currentDevice] ;
[myDevice beginGeneratingDeviceOrientationNotifications];
UIDeviceOrientation deviceOrientation = myDevice.orientation;
BOOL isCurrentlyLandscapeView = UIDeviceOrientationIsLandscape(deviceOrientation);
[myDevice endGeneratingDeviceOrientationNotifications];
私の考えでは、これはうまくいくはずです。デバイスがデバイスの向きの通知を受信できるようにし、デバイスの向きを尋ねますが、機能せず、理由がわかりません。