The UIDeviceOrientationDidChangeNotification event does not fire when a user turns off automatic screen rotation

I can get the UIDeviceOrientationDidChangeNotification event if auto-rotation is set.

But when automatic screen rotation is turned off, the orientation notification no longer works.

The effect I want to achieve is the iPhone camera and camera +: no matter which user blocks or does not block the rotation of the screen, the application can correspond to a change in rotation immediately and correctly.

Does anyone know why a notification is not sent when the user blocks the screen rotation? How can I match the change in device orientation, even if auto-rotation is turned off?

+7
source share
1 answer

I also want to get the effect of the “Camera” application, where the application detects the orientation of the device, even if the user has set “Portrait Orientation Locked”. UIDeviceOrientationDidChangeNotification not displayed when the user has portrait orientation. I believe that the only way to determine the orientation of the device when the user has locked the orientation on the portrait is to manually work out the orientation using the UIAccelerometer .

The list of questions and answers below is related to this problem. I found them when I was looking for an answer, and you can also find them useful.

Related questions:

+3
source

All Articles