summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.iOS')
-rw-r--r--Xamarin.Forms.Platform.iOS/Platform.cs16
1 files changed, 12 insertions, 4 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Platform.cs b/Xamarin.Forms.Platform.iOS/Platform.cs
index 04874db8..8db28f6f 100644
--- a/Xamarin.Forms.Platform.iOS/Platform.cs
+++ b/Xamarin.Forms.Platform.iOS/Platform.cs
@@ -54,9 +54,8 @@ namespace Xamarin.Forms.Platform.iOS
alert.AddAction(UIAlertAction.Create(arguments.Cancel, UIAlertActionStyle.Cancel, a => arguments.SetResult(false)));
if (arguments.Accept != null)
alert.AddAction(UIAlertAction.Create(arguments.Accept, UIAlertActionStyle.Default, a => arguments.SetResult(true)));
- var page = _modals.Any() ? _modals.Last() : Page;
- var vc = GetRenderer(page).ViewController;
- vc.PresentViewController(alert, true, null);
+
+ PresentAlert(alert);
}
else
{
@@ -121,7 +120,7 @@ namespace Xamarin.Forms.Platform.iOS
alert.PopoverPresentationController.PermittedArrowDirections = 0; // No arrow
}
- pageRenderer.ViewController.PresentViewController(alert, true, null);
+ PresentAlert(alert);
}
else
{
@@ -431,6 +430,15 @@ namespace Xamarin.Forms.Platform.iOS
return Page == page || _modals.Contains(page);
}
+ void PresentAlert(UIAlertController alert)
+ {
+ var window = new UIWindow { BackgroundColor = Color.Transparent.ToUIColor() };
+ window.RootViewController = new UIViewController();
+ window.RootViewController.View.BackgroundColor = Color.Transparent.ToUIColor();
+ window.MakeKeyAndVisible();
+ window.RootViewController.PresentViewController(alert, true, null);
+ }
+
async Task PresentModal(Page modal, bool animated)
{
var modalRenderer = GetRenderer(modal);