summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS
diff options
context:
space:
mode:
authorPaul DiPietro <pauldipietro@users.noreply.github.com>2016-11-15 13:36:49 -0600
committerJason Smith <jason.smith@xamarin.com>2016-11-15 11:36:49 -0800
commit7f9f2530ca1912421e0d88cd47f185dc733cd310 (patch)
treeb2635e0df15f21e26b6f101518d078c7af7d14e7 /Xamarin.Forms.Platform.iOS
parent04cc360a39505877717d5309d9649422e602c021 (diff)
downloadxamarin-forms-7f9f2530ca1912421e0d88cd47f185dc733cd310.tar.gz
xamarin-forms-7f9f2530ca1912421e0d88cd47f185dc733cd310.tar.bz2
xamarin-forms-7f9f2530ca1912421e0d88cd47f185dc733cd310.zip
[iOS] Use separate UIWindow for UIAlertController (#481)
* [iOS] Use separate UIWindow for UIAlertController * Add similar behavior for DisplayActionSheet; consolidate behavior into PresentAlert method
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);