@@ -207,7 +207,6 @@ open class BarcodeScannerController: UIViewController {
207207
208208 open override func viewWillAppear( _ animated: Bool ) {
209209 super. viewWillAppear ( animated)
210- setupFrame ( )
211210
212211 headerView. isHidden = !isBeingPresented
213212 }
@@ -216,6 +215,16 @@ open class BarcodeScannerController: UIViewController {
216215 super. viewDidAppear ( animated)
217216 animateFocusView ( )
218217 }
218+
219+ open override func viewWillTransition( to size: CGSize , with coordinator: UIViewControllerTransitionCoordinator ) {
220+ super. viewWillTransition ( to: size, with: coordinator)
221+ coordinator. animate ( alongsideTransition: { ( context) in
222+ self . setupFrame ( )
223+ } ) { ( context) in
224+ self . focusView. layer. removeAllAnimations ( )
225+ self . animateFocusView ( )
226+ }
227+ }
219228
220229 /**
221230 `UIApplicationWillEnterForegroundNotification` action.
@@ -309,14 +318,13 @@ open class BarcodeScannerController: UIViewController {
309318 flashButton. alpha = alpha
310319 settingsButton. isHidden = status. state != . unauthorized
311320 }
312-
321+
313322 // MARK: - Layout
314-
315323 func setupFrame( ) {
316324 headerView. frame = CGRect ( x: 0 , y: 0 , width: view. frame. width, height: 64 )
317325 flashButton. frame = CGRect ( x: view. frame. width - 50 , y: 73 , width: 37 , height: 37 )
318326 infoView. frame = infoFrame
319-
327+
320328 if let videoPreviewLayer = videoPreviewLayer {
321329 videoPreviewLayer. frame = view. layer. bounds
322330 if let connection = videoPreviewLayer. connection, connection. isVideoOrientationSupported {
0 commit comments