Fix gallery action buttons not being centered in device "ears" on iPhone

XR and 11
This commit is contained in:
Shadowfacts 2020-09-12 11:40:50 -04:00
parent 34a01094f7
commit 0b6ef6517b
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 3 additions and 2 deletions

View File

@ -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