forked from shadowfacts/Tusker
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 bottomControlsView: UIView!
|
||||||
@IBOutlet weak var descriptionLabel: UILabel!
|
@IBOutlet weak var descriptionLabel: UILabel!
|
||||||
|
|
||||||
var initializedTopControlsConstrains = false
|
|
||||||
|
|
||||||
var image: UIImage?
|
var image: UIImage?
|
||||||
var gifData: Data?
|
var gifData: Data?
|
||||||
var imageDescription: String?
|
var imageDescription: String?
|
||||||
|
@ -120,8 +118,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
|
||||||
|
|
||||||
centerImage()
|
centerImage()
|
||||||
|
|
||||||
if !initializedTopControlsConstrains {
|
|
||||||
initializedTopControlsConstrains = true
|
|
||||||
if view.safeAreaInsets.top == 44 {
|
if view.safeAreaInsets.top == 44 {
|
||||||
// running on iPhone X style notched device
|
// running on iPhone X style notched device
|
||||||
let notchWidth: CGFloat = 209
|
let notchWidth: CGFloat = 209
|
||||||
|
@ -131,7 +127,6 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate {
|
||||||
closeButtonTrailingConstraint.constant = offset
|
closeButtonTrailingConstraint.constant = offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func imageForDismissalAnimation() -> UIImage? {
|
func imageForDismissalAnimation() -> UIImage? {
|
||||||
return sourceInfo?.image ?? image
|
return sourceInfo?.image ?? image
|
||||||
|
|
Loading…
Reference in New Issue