まず、実行します[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]。次に、 に登録しUIDeviceOrientationDidChangeNotificationます。通知を受け取ったら[UIDevice currentDevice].orientation、デバイスの物理的な向きを確認してください。
いくつかの重要な警告が含まれているため、これらの API のドキュメントを必ずお読みください。
また、デバイスの向きは として返されますがUIDeviceOrientation、これは とは異なりUIInterfaceOrientationます。UIInterfaceOrientationドキュメントの次の情報に注意してください。
これらの定数は、statusBarOrientationプロパティとsetStatusBarOrientation:animated:メソッドで使用します。に割り当てられ、に割り当てUIDeviceOrientationLandscapeRightられていることに注意してください。これは、デバイスを回転させるにはコンテンツを反対方向に回転させる必要があるためです。UIInterfaceOrientationLandscapeLeftUIDeviceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRight