From 357684c1171d0e41029f680963859ecf470c7798 Mon Sep 17 00:00:00 2001 From: htinlinn Date: Wed, 20 Sep 2017 18:51:00 -0400 Subject: [PATCH] Fixed an issue with the top side of dismiss button not being anchored correctly on iPhone X --- Optik/Classes/AlbumViewController.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Optik/Classes/AlbumViewController.swift b/Optik/Classes/AlbumViewController.swift index a1b54a3..f8e70c2 100644 --- a/Optik/Classes/AlbumViewController.swift +++ b/Optik/Classes/AlbumViewController.swift @@ -16,6 +16,7 @@ internal final class AlbumViewController: UIViewController { static let dismissButtonDimension: CGFloat = 60 static let transitionAnimationDuration: TimeInterval = 0.3 + static let artificialDelayDuration: TimeInterval = 0.001 } // MARK: - Properties @@ -122,13 +123,15 @@ internal final class AlbumViewController: UIViewController { if !viewDidAppear { viewDidAppear = true - // Wait for the safe area insets to be in effect and set up the constraints. - setupDismissButtonConstraints() - // UIKit doesn't animate status bar transition on iOS 9. So, manually animate it. UIView.animate(withDuration: Constants.transitionAnimationDuration, animations: { self.setNeedsStatusBarAppearanceUpdate() }) + + // Wait for the safe area insets to be in effect and set up the constraints. + DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Constants.artificialDelayDuration, execute: { + self.setupDismissButtonConstraints() + }) } }