It's hard to say that a call to shouldAutorotateToInterfaceOrientation: is made for all orientations, regardless of whether the user is trying to switch to landscape mode, and willRotate / didRotate callbacks are created only for supported orientations. What you can do is register
[[UIDevice currentDevice] orientation];
for each of them there should be a field username. Or register to notify UIDeviceOrientationDidChangeNotification . This returns a UIDeviceOrientation, regardless of the orientation of your controllers. Note that this is different from the UIInterfaceOrientation values ββthat UIViewControllers use for the interfaceOrientation property.
typedef enum { UIDeviceOrientationUnknown, UIDeviceOrientationPortrait, UIDeviceOrientationPortraitUpsideDown, UIDeviceOrientationLandscapeLeft, UIDeviceOrientationLandscapeRight, UIDeviceOrientationFaceUp, UIDeviceOrientationFaceDown } UIDeviceOrientation;
Although the two are related to each other:
typedef enum { UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft } UIInterfaceOrientation;
source share