From e598b71173122605a6282a81d02390d430de4b8b Mon Sep 17 00:00:00 2001 From: Jiaqiang Date: Tue, 19 Apr 2016 17:55:40 +0800 Subject: [PATCH] Use a most effective way to retrieve real interface orientation. UIDevice.currentDevice().orientation returns the orientation of device. UIApplication.sharedApplication().statusBarOrientation returns the orientation of UI interface. For example. 1. check out Portrait only in info.plist. 2. Setup shouldRespondToOrientationChanges=false. 3. Launch app with LandscapeLeft. Intent: orientation is .Portrait Actually: orientation is .LandscapeLeft --- camera/CameraManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/camera/CameraManager.swift b/camera/CameraManager.swift index c9615e8..5738fbe 100644 --- a/camera/CameraManager.swift +++ b/camera/CameraManager.swift @@ -593,7 +593,7 @@ public class CameraManager: NSObject, AVCaptureFileOutputRecordingDelegate, UIGe } private func _currentVideoOrientation() -> AVCaptureVideoOrientation { - switch UIDevice.currentDevice().orientation { + switch UIApplication.sharedApplication().statusBarOrientation { case .LandscapeLeft: return .LandscapeRight case .LandscapeRight: