Fix gallery action buttons not being centered in device "ears" on iPhone
XR and 11
This commit is contained in:
parent
34a01094f7
commit
0b6ef6517b
|
@ -133,8 +133,9 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate, LargeIma
|
||||||
centerImage()
|
centerImage()
|
||||||
|
|
||||||
// todo: does this need to be in viewDidLayoutSubviews?
|
// todo: does this need to be in viewDidLayoutSubviews?
|
||||||
if view.safeAreaInsets.top == 44 {
|
// on iPhone X, Xs, Xs Max, 11 Pro, 11 Pro Max, the top safe area inset is 44pts
|
||||||
// running on iPhone X style notched device
|
// on iPhone XR, 11, the top inset is 48pts
|
||||||
|
if view.safeAreaInsets.top == 44 || view.safeAreaInsets.top == 48 {
|
||||||
let notchWidth: CGFloat = 209
|
let notchWidth: CGFloat = 209
|
||||||
let earWidth = (view.bounds.width - notchWidth) / 2
|
let earWidth = (view.bounds.width - notchWidth) / 2
|
||||||
let offset = (earWidth - shareButton.bounds.width) / 2
|
let offset = (earWidth - shareButton.bounds.width) / 2
|
||||||
|
|
Loading…
Reference in New Issue