- UIDevice *device = [UIDevice currentDevice];
- switch (device.orientation;) {
- case UIDeviceOrientationFaceUp:
- NSLog(@"屏幕朝上平躺");
- break;
- case UIDeviceOrientationFaceDown:
- NSLog(@"屏幕朝下平躺");
- break;
- //系统无法判断目前Device的方向,有可能是斜置
- case UIDeviceOrientationUnknown:
- NSLog(@"未知方向");
- break;
- case UIDeviceOrientationLandscapeLeft:
- NSLog(@"屏幕向左
- //该片段来自于http://www.codesnippet.cn/detail/051220137765.html
来源: http://www.codesnippet.cn/detail/051220137765.html