From 013bb81b0fe963bed8f1602133cbf5508e609244 Mon Sep 17 00:00:00 2001 From: iDevelopper Date: Sun, 29 Sep 2024 13:00:25 +0200 Subject: [PATCH] Fixes a popup bar layout issue for custom container. --- .../NSObject+PBPopupSupportPrivate.h | 2 +- .../Private/NSObject+PBPopupSupportPrivate.m | 2 +- .../UIViewController+Private.swift | 9 ++++++-- .../Base.lproj/Custom.storyboard | 22 +++++++++++++------ .../DemoChildViewController.swift | 7 ++++++ 5 files changed, 31 insertions(+), 11 deletions(-) diff --git a/PBPopupController/PBPopupController/PBPopupController-ObjC/NSObject+PBPopupSupportPrivate.h b/PBPopupController/PBPopupController/PBPopupController-ObjC/NSObject+PBPopupSupportPrivate.h index 0dc5cdc..dbbb113 100644 --- a/PBPopupController/PBPopupController/PBPopupController-ObjC/NSObject+PBPopupSupportPrivate.h +++ b/PBPopupController/PBPopupController/PBPopupController-ObjC/NSObject+PBPopupSupportPrivate.h @@ -19,7 +19,7 @@ id __pb_transitionCoordinator(UIViewContr @end -@interface __LNFakeContext: NSObject +@interface __PBFakeContext: NSObject @property(nonatomic, getter=isCancelled) BOOL cancelled; diff --git a/PBPopupController/PBPopupController/PBPopupController-ObjC/Private/NSObject+PBPopupSupportPrivate.m b/PBPopupController/PBPopupController/PBPopupController-ObjC/Private/NSObject+PBPopupSupportPrivate.m index 4eebbec..7a4be49 100644 --- a/PBPopupController/PBPopupController/PBPopupController-ObjC/Private/NSObject+PBPopupSupportPrivate.m +++ b/PBPopupController/PBPopupController/PBPopupController-ObjC/Private/NSObject+PBPopupSupportPrivate.m @@ -54,4 +54,4 @@ NSTimeInterval __pb_durationForTransition(UIViewController* vc, NSUInteger trans @end -@implementation __LNFakeContext @end +@implementation __PBFakeContext @end diff --git a/PBPopupController/PBPopupController/PBPopupController-Swift/UIViewController+Private.swift b/PBPopupController/PBPopupController/PBPopupController-Swift/UIViewController+Private.swift index 7e47448..6bc0267 100644 --- a/PBPopupController/PBPopupController/PBPopupController-Swift/UIViewController+Private.swift +++ b/PBPopupController/PBPopupController/PBPopupController-Swift/UIViewController+Private.swift @@ -1138,7 +1138,12 @@ public extension UIViewController self.pb_viewDidLayoutSubviews() if let rv = UIViewController.getAssociatedPopupBarFor(self) { if !(self is UITabBarController) && !(self is UINavigationController) { - rv.backgroundView.alpha = rv.isFloating ? 0.0 : 1.0 + if rv.isFloating { + rv.backgroundView.alpha = self.bottomBarIsHidden() ? 0.0 : 1.0 + } + else { + rv.backgroundView.alpha = 1.0 + } } if self is UITabBarController { @@ -1243,7 +1248,7 @@ internal extension UIViewController } @objc func bottomBarIsHidden() -> Bool { - return self.bottomBar.isHidden + return self.bottomBar.isHidden || self.bottomBar.frame.height == 0.0 } @objc func insetsForBottomBar() -> UIEdgeInsets diff --git a/PBPopupControllerSample/PBPopupControllerSample/Base.lproj/Custom.storyboard b/PBPopupControllerSample/PBPopupControllerSample/Base.lproj/Custom.storyboard index 44ef732..41ecf0f 100755 --- a/PBPopupControllerSample/PBPopupControllerSample/Base.lproj/Custom.storyboard +++ b/PBPopupControllerSample/PBPopupControllerSample/Base.lproj/Custom.storyboard @@ -1,9 +1,9 @@ - + - + @@ -300,10 +300,18 @@ - + +