UIDeviceOrientation
指设备的物理方向,而UIInterfaceOrientation
指用户界面的方向。当你调用你的方法时
[self orientationChanged:interfaceOrientation];
你很可能会通过它UIDeviceOrientation
根据方法,当你应该使用UIInterfaceOrientation
.
只是为了扩展这一点,UIDeviceOrientation
是的财产UIDevice
类,并且有以下可能的值:
UIDeviceOrientationUnknown
- 无法确定
UIDeviceOrientationPortrait
- 主页按钮朝下
UIDeviceOrientationPortraitUpsideDown
- 主页按钮朝上
UIDeviceOrientationLandscapeLeft
- 主页按钮朝右
UIDeviceOrientationLandscapeRight
- 主页按钮朝左
UIDeviceOrientationFaceUp
- 设备平坦,屏幕朝上
UIDeviceOrientationFaceDown
- 设备平坦,屏幕朝下
As for UIInterfaceOrientation
,它是一个属性UIApplication
并且仅包含与状态栏方向相对应的 4 种可能性:
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
To get UIDeviceOrientation
, 你用
[[UIDevice currentDevice] orientation]
并得到UIInterfaceOrientation
, 你用
[[UIApplication sharedApplication] statusBarOrientation]