How can I get the current screen orientation?

Hello,

I am working on an iOS app that has interactive components that react to the device accelerometer. The app works in landscape left and right only, and I need some way to identify if the screen is left or right to get the acceleration direction correct. Basically, accelerating to the device's "left" means you actually need to move the elements on screen to the left or right depending on screen direction.

One solution I tried is using UIDeviceOrientation. This works in most cases, but when screen lock is on, it gives an update about the device orientation when the screen itself didn't tilt.

Is there some other way to get the screen orientation that accurately reflects the screen orientation and not just device orientation?

Thank you.

How can I get the current screen orientation?
 
 
Q