How to get iPhones current orientation?

This is most likely what you want:

UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation];

You can then use system macros like:

if (UIInterfaceOrientationIsPortrait(interfaceOrientation))
{

}

If you want the device orientation use:

UIDeviceOrientation deviceOrientation = [[UIDevice currentDevice] orientation];

This includes enumerations like UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown


As discussed in other answers, you need the interfaceOrientation, not the deviceOrientation.

The easiest way to get to this, is to use the property interfaceOrientation on your UIViewController. (So most often, just: self.interfaceOrientation will do).

Possible values are:

UIInterfaceOrientationPortrait           = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft      = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight     = UIDeviceOrientationLandscapeLeft

Remember: Left orientation is entered by turning your device to the right.