Fix large image controls being positioned incorrectly on notched-devices
when opening via a context menu preview. The constraints for the top controls were being set only once, but when showing a large image in the contxt menu preview window, the top inset safe area is 0 and didn't become 44 (the value for notched devices) until the preview was expanded. Fixes #86
This commit is contained in:
parent
20c602f911
commit
8c7bebcce8
|
@ -37,8 +37,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
|
|||
@IBOutlet weak var bottomControlsView: UIView!
|
||||
@IBOutlet weak var descriptionLabel: UILabel!
|
||||
|
||||
var initializedTopControlsConstrains = false
|
||||
|
||||
var image: UIImage?
|
||||
var gifData: Data?
|
||||
var imageDescription: String?
|
||||
|
@ -120,8 +118,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
|
|||
|
||||
centerImage()
|
||||
|
||||
if !initializedTopControlsConstrains {
|
||||
initializedTopControlsConstrains = true
|
||||
if view.safeAreaInsets.top == 44 {
|
||||
// running on iPhone X style notched device
|
||||
let notchWidth: CGFloat = 209
|
||||
|
@ -131,7 +127,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
|
|||
closeButtonTrailingConstraint.constant = offset
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func imageForDismissalAnimation() -> UIImage? {
|
||||
return sourceInfo?.image ?? image
|
||||
|
|
Loading…
Reference in New Issue