How to get current orientation of device programmatically in iOS 6?

前端 未结 8 818
庸人自扰
庸人自扰 2020-12-30 23:50

I have developed an iOS App and tested it on iOS6 device. While testing, I realized that my App is not responding to Orientation changes as expected.

Here is my Code

8条回答
  •  感动是毒
    2020-12-31 00:29

    Follow the documentation on UIDevice.

    You need to call

    [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
    

    Then every time the orientation is changed you will receive a UIDeviceOrientationDidChangeNotification.

提交回复
热议问题