I'm trying to find out if the device is in portrait or landscape mode. My code works quite well if the device is not facing up. If it does face up (and orientation == 5), it won't distinguish between portrait and landscape. Is there anyway to determine the "orientation" in terms of landscape / portrait if the UIDeviceOrientation is FaceUp?
My code:
UIDeviceOrientation interfaceOrientation = [[UIDevice currentDevice] orientation];
NSLog(@"orientation: %d", interfaceOrientation);
if (interfaceOrientation == UIDeviceOrientationIsLandscape(interfaceOrientation)) {
NSLog(@"LANDSCAPE!!!");
}
if (interfaceOrientation == UIDeviceOrientationIsPortrait(interfaceOrientation)) {
NSLog(@"PORTRAIT!!!");
}