iOS Shouldn’t Have 6 Device Orientations
For a small iPad project, I happened to use iPad’s orientation stuff. As it turns out, there is always a catch.
In UIDevice class , you see the following orientations:
typedef enum
{
UIDeviceOrientationUnknown,
UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom
UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top
UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right
UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left
UIDeviceOrientationFaceUp, // Device oriented flat, face up
UIDeviceOrientationFaceDown // Device oriented flat, face down
} UIDeviceOrientation;
But for a view controller’s parent, there are only four
self.parentViewController.interfaceOrientation only has
typedef enum
{
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;
So the problem arises when you try to layout according to
[UIDevice currentDevice].orientation
When the device orientation is UIDeviceOrientationFaceUp or UIDeviceOrientationFaceDown, you get 3 orientation changed calls. One is the up and down, than a landscape, than again up or down.
This is, to be honest, completely broken. It is clear that, since the status bar can be located to four locations on the screen, there should be 4 device orientations, not 6. The FaceUp and FaceDown should be a different property I guess (gravityOrientation or sth like that)
ps. Some links that can help if you have issues with this up&down thing






Hi,
I just found your blog because i meet the same situation in my current iphone-ipad development project. I was searching the internet like a mad trying to find a proper solution, finally i programmed my own approach to deal with this multiple notifications.
Here you can read the code and my implementation
http://www.littleaps.com/littleAps_Software/littleBlog/Entradas/2011/6/16_How_to_handle_UIDeviceOrientation_for_manage_views_layouts.html