what are the correct values for detecting the device upside down?
I have the following and it starts detecting when the user has titled the device on its back.
I use the following values
float xx = -[acceleration x];
float yy = [acceleration y];
float angle = atan2(yy, xx);
if(angle >= 0.75 && angle <= 2.25)
{
NSLog(@"Upside down");
}
Start listening for orientation events by using:
UIDevice *currDevice = [UIDevice currentDevice];
[currDevice beginGeneratingDeviceOrientationNotifications];
Then, get the orientation using:
currDevice.orientation
These are the values that are returned:
{'1' : 'Portrait', '2' : 'PortraitUpsideDown', '3' : 'LandscapeLeft', '4' : 'LandscapeRight', '5' : 'FaceUp', '6' : 'FaceDown'}