开发者

UIDevice Orientation not returning the correct value

开发者 https://www.devze.com 2023-02-04 00:46 出处:网络
Hey this is the code I am using switch ([[UIDevice currentDevice] orientation]) { case UIInterfaceOrientationPortrait:

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

精彩评论

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