How to get iPhones current orientation?

Posted by Mike Rychev on Stack Overflow See other posts from Stack Overflow or by Mike Rychev
Published on 2010-03-25T19:25:33Z Indexed on 2010/03/25 19:33 UTC
Read the original article Hit count: 188

Filed under:
|

Is there a special method to get iPhones orientation? I don't need it in degrees or radians, I want it to return an UIInterfaceOrientation object. I just need it for an if-else construction like

if(currentOrientation==UIInterfaceOrientationPortrait ||currentOrientation==UIInterfaceOrientationPortraitUpsideDown) {
//Code
}  
if (currentOrientation==UIInterfaceOrientationLandscapeRight ||currentOrientation==UIInterfaceOrientationLandscapeLeft ) {
//Code
}

Thanks in advance!

© Stack Overflow or respective owner

Related posts about accelerometer

Related posts about objective-c