I\'m trying to disable any discernable orientation rotation to an AVCaptureVideoPreviewLayer while still maintaining rotation for any subviews. AVCaptureVideoPreviewLayer does h
In swift I use:
override func willAnimateRotationToInterfaceOrientation(toInterfaceOrientation: UIInterfaceOrientation, duration: NSTimeInterval) {
if !UIDevice.currentDevice().model.contains("Simulator") {
if (toInterfaceOrientation == .Portrait) {
prevLayer?.transform = CATransform3DMakeRotation(0, 0, 0, 1)
} else if (toInterfaceOrientation == .LandscapeLeft) {
prevLayer?.transform = CATransform3DMakeRotation(CGFloat(M_PI)/2, 0, 0, 1)
} else if (toInterfaceOrientation == .LandscapeRight) {
prevLayer?.transform = CATransform3DMakeRotation(-CGFloat(M_PI)/2, 0, 0, 1)
}
prevLayer?.frame = self.scanView.frame
}
}