开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜