Search code examples
iphoneiosuiinterfaceorientationuideviceorientation

iPhone - Screen Rotation?


What's the difference between UIDeviceOrientation & UIInterfaceOrientation ?

Which one should I use to detect rotation on a UIView?


Solution

  • UIDeviceOrientation gives you information about the physical device itself while UIInterfaceOrientation tells you about the orientation of the views it is displaying. These do not need to match; when a user uses the orientation lock or if the the device orientation is face up.

    You probably want to be checking UIInterfaceOrientation and the rotation methods on UIViewController to determine when views have been or should be rotated.