views:

502

answers:

2

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!

+2  A: 

Ask the current UIDevice for its orientation.

Chuck
+3  A: 

With something like

UIInterfaceOrientation orientation = [[UIDevice currentDevice] orientation]
Satyajit
Yep, it worked! Than you very much!
Knodel