2018-07-03

UIDeviceOrientation、UIInterfaceOrientation、UIInterfaceOrientationMask区别
1、UIDeviceOrientation:设备的物理方向
typedef enum UIDeviceOrientation : NSInteger {
UIDeviceOrientationUnknown, // 无法确定设备的方向
UIDeviceOrientationPortrait, // 设备处于竖屏模式,设备直立,底部有home键
UIDeviceOrientationPortraitUpsideDown, // 设备处于竖屏模式,但上下颠倒,设备保持直立,home按钮位于顶部。
UIDeviceOrientationLandscapeLeft, // 设备处于横屏模式,设备直立,右侧为home键
UIDeviceOrientationLandscapeRight, // 设备处于横屏模式,设备直立,左侧为home键
UIDeviceOrientationFaceUp, // 设备与地面平行,屏幕朝上
UIDeviceOrientationFaceDown // 设备与地面平行,屏幕朝下。
} UIDeviceOrientation;


2、UIInterfaceOrientation:应用程序用户界面的方向 typedef enum UIInterfaceOrientation : NSInteger {
UIInterfaceOrientationUnknown = UIDeviceOrientationUnknown,
UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait,
UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown,
UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight,
UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft
} UIInterfaceOrientation;
注意:UIDeviceOrientationLandscapeRight分配给UIInterfaceOrientationLandscapeLeft, UIDeviceOrientationLandscapeLeft分配给UIInterfaceOrientationLandscapeRight; 原因是旋转设备需要将内容旋转到相反的方向。
3、UIInterfaceOrientationMask:这些常量是指定视图控制器支持的接口方向的掩码位
typedef enum UIInterfaceOrientationMask : NSUInteger {
UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait), // 视图控制器支持纵向界面方向。
UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft), // 视图控制器支持景观左界面朝向
UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight), // 视图控制器支持景观右界面朝向
UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown), // 视图控制器支持一个倒置的纵向界面方向。
UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), // 视图控制器同时支持景观向左和景观向右的界面朝向
UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown), // 视图控制器支持所有的接口方向。
UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight) // 视图控制器支持所有的,除了颠倒的人像界面朝向。
【2018-07-03】} UIInterfaceOrientationMask;

    推荐阅读