Fix gallery controls insets on iPhone 16
And change the default to the dynamic island metrics, so I hopefully don't have to touch this every year
This commit is contained in:
parent
506d2ad8a9
commit
263210ac3c
|
@ -378,9 +378,6 @@ class GalleryItemViewController: UIViewController {
|
||||||
47, // iPhone 12, 12 Pro, 12 Pro Max, 13, 13 Pro, 13 Pro Max, 14, 14 Plus
|
47, // iPhone 12, 12 Pro, 12 Pro Max, 13, 13 Pro, 13 Pro Max, 14, 14 Plus
|
||||||
50, // iPhone 12 mini, 13 mini
|
50, // iPhone 12 mini, 13 mini
|
||||||
]
|
]
|
||||||
let islandDeviceTopInsets: [CGFloat] = [
|
|
||||||
59, // iPhone 14 Pro, 14 Pro Max, 15 Pro, 15 Pro Max
|
|
||||||
]
|
|
||||||
if notchedDeviceTopInsets.contains(view.safeAreaInsets.top) {
|
if notchedDeviceTopInsets.contains(view.safeAreaInsets.top) {
|
||||||
// the notch width is not the same for the iPhones 13,
|
// the notch width is not the same for the iPhones 13,
|
||||||
// but what we actually want is the same offset from the edges
|
// but what we actually want is the same offset from the edges
|
||||||
|
@ -390,16 +387,18 @@ class GalleryItemViewController: UIViewController {
|
||||||
let offset = (earWidth - (shareButton.imageView?.bounds.width ?? 0)) / 2
|
let offset = (earWidth - (shareButton.imageView?.bounds.width ?? 0)) / 2
|
||||||
shareButtonLeadingConstraint.constant = offset
|
shareButtonLeadingConstraint.constant = offset
|
||||||
closeButtonTrailingConstraint.constant = offset
|
closeButtonTrailingConstraint.constant = offset
|
||||||
} else if islandDeviceTopInsets.contains(view.safeAreaInsets.top) {
|
} else if view.safeAreaInsets.top == 0 {
|
||||||
shareButtonLeadingConstraint.constant = 24
|
// square corner devices
|
||||||
shareButtonTopConstraint.constant = 24
|
|
||||||
closeButtonTrailingConstraint.constant = 24
|
|
||||||
closeButtonTopConstraint.constant = 24
|
|
||||||
} else {
|
|
||||||
shareButtonLeadingConstraint.constant = 8
|
shareButtonLeadingConstraint.constant = 8
|
||||||
shareButtonTopConstraint.constant = 8
|
shareButtonTopConstraint.constant = 8
|
||||||
closeButtonTrailingConstraint.constant = 8
|
closeButtonTrailingConstraint.constant = 8
|
||||||
closeButtonTopConstraint.constant = 8
|
closeButtonTopConstraint.constant = 8
|
||||||
|
} else {
|
||||||
|
// dynamic island devices
|
||||||
|
shareButtonLeadingConstraint.constant = 24
|
||||||
|
shareButtonTopConstraint.constant = 24
|
||||||
|
closeButtonTrailingConstraint.constant = 24
|
||||||
|
closeButtonTopConstraint.constant = 24
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue