Support positing large image VC controls in iPhone 12/Pro/Mini ears

This commit is contained in:
Shadowfacts 2020-10-13 21:12:21 -04:00
parent 7883b04618
commit 288f855e2f
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 7 additions and 3 deletions

View File

@ -133,9 +133,13 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate, LargeIma
centerImage() centerImage()
// todo: does this need to be in viewDidLayoutSubviews? // todo: does this need to be in viewDidLayoutSubviews?
// on iPhone X, Xs, Xs Max, 11 Pro, 11 Pro Max, the top safe area inset is 44pts let notchedDeviceTopInsets: [CGFloat] = [
// on iPhone XR, 11, the top inset is 48pts 44, // iPhone X, Xs, Xs Max, 11 Pro, 11 Pro Max
if view.safeAreaInsets.top == 44 || view.safeAreaInsets.top == 48 { 48, // iPhone XR, 11
47, // iPhone 12, 12 Pro, 12 Pro Max
50, // iPhone 12 mini
]
if notchedDeviceTopInsets.contains(view.safeAreaInsets.top) {
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