Search code examples
iphoneiosdevice-orientation

UIDevice Orientation


How to find out if the UIDeviceOrientationFaceUp is landscape FaceUp or Portrait FaceUp?

Can any one tell me?


Solution

  • It's not possible, because the accelerometer can't detect rotation around the z axis. On an iPhone 4, you could perhaps use the gyroscope for this (using CoreMotion), but UIDevice doesn't have an API for this. You would then also have to define what the starting position is, because you can't detect in which direction the user is from the device's point of view.