【问题标题】:UIDevice Orientation not returning the correct valueUIDevice Orientation 没有返回正确的值
【发布时间】:2011-06-09 02:22:42
【问题描述】:

嘿,这是我正在使用的代码

switch ([[UIDevice currentDevice] orientation]) 

        {
            case UIInterfaceOrientationPortrait:
                [self displayActionSheetInPotraitMode];
                break;
            case UIInterfaceOrientationLandscapeLeft:
            case UIInterfaceOrientationLandscapeRight:
                [self displayActionSheetInLandscapeMode];
                break;

            default:
                break;
        }

但是当我在设备上的 iOS 版本 4 或 4.1 中尝试时

switch ([[UIDevice currentDevice] 方向])

没有返回正确的值。我的应用程序将在 IOS 4 及更高版本中运行。我该如何纠正这个问题?

【问题讨论】:

    标签: iphone


    【解决方案1】:

    看看这个

    Getting wrong orientation

    要不然试试

    UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
    

    然后

    switch(orientation)
    

    干杯

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-26
      • 2019-03-21
      • 1970-01-01
      • 2014-07-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多