From a8308005a1a609eec3a7c02f66f8767574feadfd Mon Sep 17 00:00:00 2001 From: Kiryl <79797627+kirylkaveryn@users.noreply.github.com> Date: Sat, 23 Dec 2023 01:19:13 +0400 Subject: [PATCH] [ios] Fix the missing PP screen on iPad on iOS 12 (#6931) * fix: freezing pp on ios 12 Signed-off-by: Kiryl Kaveryn * Update iphone/Maps/UI/PlacePage/PlacePageViewController.swift Signed-off-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com> --------- Signed-off-by: Kiryl Kaveryn Signed-off-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com> Co-authored-by: Alexander Borsuk <170263+biodranik@users.noreply.github.com> --- iphone/Maps/UI/PlacePage/PlacePageViewController.swift | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/iphone/Maps/UI/PlacePage/PlacePageViewController.swift b/iphone/Maps/UI/PlacePage/PlacePageViewController.swift index 95e0442907..977c3778d5 100644 --- a/iphone/Maps/UI/PlacePage/PlacePageViewController.swift +++ b/iphone/Maps/UI/PlacePage/PlacePageViewController.swift @@ -75,7 +75,8 @@ final class PlacePageScrollView: UIScrollView { actionBarContainerView.layer.masksToBounds = true actionBarContainerView.layer.maskedCorners = [.layerMinXMaxYCorner, .layerMaxXMaxYCorner] - if previousTraitCollection == nil { + // See https://github.com/organicmaps/organicmaps/issues/6917 for the details. + if #available(iOS 13.0, *), previousTraitCollection == nil { scrollView.contentInset = alternativeSizeClass(iPhone: UIEdgeInsets(top: view.height, left: 0, bottom: 0, right: 0), iPad: UIEdgeInsets.zero) scrollView.layoutIfNeeded() @@ -84,6 +85,13 @@ final class PlacePageScrollView: UIScrollView { override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() + if #available(iOS 13.0, *) { + // See https://github.com/organicmaps/organicmaps/issues/6917 for the details. + } else if previousTraitCollection == nil { + scrollView.contentInset = alternativeSizeClass(iPhone: UIEdgeInsets(top: scrollView.height, left: 0, bottom: 0, right: 0), + iPad: UIEdgeInsets.zero) + updateSteps() + } panGesture.isEnabled = alternativeSizeClass(iPhone: false, iPad: true) previousTraitCollection = traitCollection }