From 9d73db39197f58cd4a035196410b81a27b577e4d Mon Sep 17 00:00:00 2001 From: Santos Date: Fri, 4 Oct 2019 14:45:16 -0400 Subject: [PATCH] PanModal Portrait to Landscape Issue (#53) * Fix issue where transitioning from portrait to landscape would cause a PanModal's view to disappear if its height was short * improve transitioning to landscape fix --- PanModal/Controller/PanModalPresentationController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PanModal/Controller/PanModalPresentationController.swift b/PanModal/Controller/PanModalPresentationController.swift index e497a28..5d18d88 100644 --- a/PanModal/Controller/PanModalPresentationController.swift +++ b/PanModal/Controller/PanModalPresentationController.swift @@ -226,7 +226,6 @@ public class PanModalPresentationController: UIPresentationController { else { return } self.adjustPresentedViewFrame() - if presentable.shouldRoundTopCorners { self.addRoundedCorners(to: self.presentedView) } @@ -367,7 +366,13 @@ private extension PanModalPresentationController { else { return } let adjustedSize = CGSize(width: frame.size.width, height: frame.size.height - anchoredYPosition) + let panFrame = panContainerView.frame panContainerView.frame.size = frame.size + + if ![shortFormYPosition, longFormYPosition].contains(panFrame.origin.y) { + adjust(toYPosition: panFrame.origin.y - panFrame.height + frame.height) + } + panContainerView.frame.origin.x = frame.origin.x presentedViewController.view.frame = CGRect(origin: .zero, size: adjustedSize) }