2

我想获取设备的当前方向。我在 AppDelegate 类中编写了这段代码:我的代码:

if (UIInterfaceOrientation.LandscapeLeft == (UIInterfaceOrientation)UIDevice.CurrentDevice.Orientation &&
            UIInterfaceOrientation.LandscapeRight == (UIInterfaceOrientation)UIDevice.CurrentDevice.Orientation) {
            //code
        } else {
            //code
        }

UIDevice.CurrentDevice.Orientation 给出未知数?

4

1 回答 1

1

你可以使用你的InterfaceOrientation财产UIViewController吗?

这可能是一个更好的检查值,因为它是您的应用当前旋转并“允许”旋转到的状态。检查UIDevice可能与 UI 的旋转不匹配。

于 2013-01-09T13:57:14.910 回答