Skip to content

Commit

Permalink
Fixed an issue with the top side of dismiss button not being anchored…
Browse files Browse the repository at this point in the history
… correctly on iPhone X
  • Loading branch information
htinlinn committed Sep 20, 2017
1 parent e814341 commit 357684c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Optik/Classes/AlbumViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
})
}
}

Expand Down

0 comments on commit 357684c

Please sign in to comment.