UIDevice Orientation not returning the correct value
Hey this is the code I am using
switch ([[UIDevice currentDevice] orientation])
{
case UIInterfaceOrientationPortrait:
[self displayActionSheetInPotraitMode];
break;
case UIInterfaceOrientationLandscapeLeft:
case UIInterfaceOrientationLandscapeRight:
开发者_高级运维 [self displayActionSheetInLandscapeMode];
break;
default:
break;
}
but when I try it in iOS version 4 or 4.1 on the device
switch ([[UIDevice currentDevice] orientation])
doesn't return the proper value. My application is to run in IOS 4 onwards. How do I rectify this?
Have a look at this
Getting wrong orientation
or else try
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
and then
switch(orientation)
Cheers
精彩评论