Skip to content

Commit eecdb23

Browse files
authored
Merge pull request #52 from icefall/bugfix-screen-orientation
Bugfix screen orientation + change number of lines of InfoLabel
2 parents fa82037 + 73f0d7c commit eecdb23

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

Sources/BarcodeScannerController.swift

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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 {

Sources/InfoView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class InfoView: UIVisualEffectView {
88
/// Text label.
99
lazy var label: UILabel = {
1010
let label = UILabel()
11-
label.numberOfLines = 2
11+
label.numberOfLines = 3
1212

1313
return label
1414
}()

0 commit comments

Comments
 (0)