一、两种orientation
了解屏幕旋转首先需要区分两种orientation
1、device orientation
设备的物理方向,由类型UIDeviceOrientation表示,当前设备方向获取方式:
1 | [UIDevice currentDevice].orientation |
该属性的值一般是与当前设备方向保持一致的,但须注意以下几点:
①文档中对该属性的注释:
1 | @property(nonatomic,readonly) UIDeviceOrientation orientation; // return current device orientation. this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated. |
所以更推荐下面这种用法:
