allow disabling of responding to device orientation changes

This commit is contained in:
Simon Leonhardt 2015-12-07 23:44:41 +00:00
parent bf9add31dd
commit f0340013cc
1 changed files with 3 additions and 1 deletions

View File

@ -57,6 +57,8 @@ public class CameraManager: NSObject, AVCaptureFileOutputRecordingDelegate {
/// Property to determine if manager should write the resources to the phone library. Default value is true.
public var writeFilesToPhoneLibrary = true
public var shouldRespondToOrientationChanges = true
/// The Bool property to determine if current device has front camera.
public var hasFrontCamera: Bool = {
@ -533,7 +535,7 @@ public class CameraManager: NSObject, AVCaptureFileOutputRecordingDelegate {
}
private func _startFollowingDeviceOrientation() {
if !cameraIsObservingDeviceOrientation {
if shouldRespondToOrientationChanges && !cameraIsObservingDeviceOrientation {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "_orientationChanged", name: UIDeviceOrientationDidChangeNotification, object: nil)
cameraIsObservingDeviceOrientation = true
}