Skip to content

Commit bce50e8

Browse files
authored
Merge pull request #660 from UbiPark/develop
Fix: Fix the popup windows issues for iOS 13+ when the multi scene is enabled
2 parents 1d322cb + 2936815 commit bce50e8

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Rg.Plugins.Popup/Platforms/Ios/Impl/PopupPlatformIos.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,19 @@ public Task AddAsync(PopupPage page)
5555

5656
var renderer = page.GetOrCreateRenderer();
5757

58-
var window = new PopupWindow();
59-
58+
PopupWindow window;
6059
if (IsiOS13OrNewer)
60+
{
61+
var connectedScene = UIApplication.SharedApplication.ConnectedScenes.ToArray().FirstOrDefault(x => x.ActivationState == UISceneActivationState.ForegroundActive);
62+
if (connectedScene != null && connectedScene is UIWindowScene windowScene)
63+
window = new PopupWindow(windowScene);
64+
else
65+
window = new PopupWindow();
66+
6167
_windows.Add(window);
68+
}
69+
else
70+
window = new PopupWindow();
6271

6372
window.BackgroundColor = Color.Transparent.ToUIColor();
6473
window.RootViewController = new PopupPlatformRenderer(renderer);

Rg.Plugins.Popup/Platforms/Ios/Platform/PopupWindow.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ public PopupWindow()
2020

2121
}
2222

23+
public PopupWindow(UIWindowScene uiWindowScene) : base(uiWindowScene)
24+
{
25+
26+
}
27+
2328
public override UIView HitTest(CGPoint point, UIEvent? uievent)
2429
{
2530
var platformRenderer = (PopupPlatformRenderer?)RootViewController;

0 commit comments

Comments
 (0)