diff --git a/Tusker/Screens/Large Image/LargeImageViewController.swift b/Tusker/Screens/Large Image/LargeImageViewController.swift index 7661a6bf..e8ad7956 100644 --- a/Tusker/Screens/Large Image/LargeImageViewController.swift +++ b/Tusker/Screens/Large Image/LargeImageViewController.swift @@ -118,8 +118,11 @@ class LargeImageViewController: UIViewController, UIScrollViewDelegate { override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - let widthScale = view.bounds.size.width / imageView.bounds.width - let heightScale = view.bounds.size.height / imageView.bounds.height + // limit the image height to the safe area height, so the image doesn't overlap the top controls + // while zoomed all the way out + let maxHeight = view.bounds.height - view.safeAreaInsets.top - view.safeAreaInsets.bottom + let heightScale = maxHeight / imageView.bounds.height + let widthScale = view.bounds.width / imageView.bounds.width let minScale = min(widthScale, heightScale) scrollView.minimumZoomScale = minScale scrollView.zoomScale = minScale