diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-12-09 10:17:27 -0800 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-12-09 10:17:27 -0800 |
commit | 899e2bd591bf33cf99c1db95666f1313ff80565b (patch) | |
tree | 5f8712401e45895c8aaf79ce8674f76c7f387967 /Xamarin.Forms.Platform.iOS/Platform.cs | |
parent | c4b1c88f506ebf76a2a40f005b45ec9b24e46e1a (diff) | |
download | xamarin-forms-899e2bd591bf33cf99c1db95666f1313ff80565b.tar.gz xamarin-forms-899e2bd591bf33cf99c1db95666f1313ff80565b.tar.bz2 xamarin-forms-899e2bd591bf33cf99c1db95666f1313ff80565b.zip |
Revert "Deprecate iOS 8 and earlier (#626)"
This reverts commit c4b1c88f506ebf76a2a40f005b45ec9b24e46e1a.
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/Platform.cs')
-rw-r--r-- | Xamarin.Forms.Platform.iOS/Platform.cs | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.iOS/Platform.cs b/Xamarin.Forms.Platform.iOS/Platform.cs index 805aba7d..c9c31887 100644 --- a/Xamarin.Forms.Platform.iOS/Platform.cs +++ b/Xamarin.Forms.Platform.iOS/Platform.cs @@ -46,7 +46,14 @@ namespace Xamarin.Forms.Platform.iOS if (!PageIsChildOfPlatform(sender)) return; - PresentAlert(arguments); + if (Forms.IsiOS8OrNewer) + { + PresentAlert(arguments); + } + else + { + PresentPre8Alert(arguments); + } }); MessagingCenter.Subscribe(this, Page.ActionSheetSignalName, (Page sender, ActionSheetArguments arguments) => @@ -57,8 +64,16 @@ namespace Xamarin.Forms.Platform.iOS var pageRoot = sender; while (!Application.IsApplicationOrNull(pageRoot.RealParent)) pageRoot = (Page)pageRoot.RealParent; + var pageRenderer = GetRenderer(pageRoot); - PresentActionSheet(arguments); + if (Forms.IsiOS8OrNewer) + { + PresentActionSheet(arguments); + } + else + { + PresentPre8ActionSheet(arguments, pageRenderer); + } }); } @@ -437,6 +452,12 @@ namespace Xamarin.Forms.Platform.iOS alert.PopoverPresentationController.PermittedArrowDirections = 0; // No arrow } + if(!Forms.IsiOS9OrNewer) + { + // For iOS 8, we need to explicitly set the size of the window + window.Frame = new RectangleF(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height); + } + window.RootViewController.PresentViewController(alert, true, null); } @@ -470,6 +491,18 @@ namespace Xamarin.Forms.Platform.iOS await Task.Delay(5); } + void PresentPre8Alert(AlertArguments arguments) + { + UIAlertView alertView; + if (arguments.Accept != null) + alertView = new UIAlertView(arguments.Title, arguments.Message, null, arguments.Cancel, arguments.Accept); + else + alertView = new UIAlertView(arguments.Title, arguments.Message, null, arguments.Cancel); + + alertView.Dismissed += (o, args) => arguments.SetResult(args.ButtonIndex != 0); + alertView.Show(); + } + void PresentPre8ActionSheet(ActionSheetArguments arguments, IVisualElementRenderer pageRenderer) { var actionSheet = new UIActionSheet(arguments.Title, null, arguments.Cancel, arguments.Destruction, |