summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Platform.iOS/PlatformRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.iOS/PlatformRenderer.cs85
1 files changed, 85 insertions, 0 deletions
diff --git a/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
new file mode 100644
index 00000000..43534b2b
--- /dev/null
+++ b/Xamarin.Forms.Platform.iOS/PlatformRenderer.cs
@@ -0,0 +1,85 @@
+using System;
+#if __UNIFIED__
+using UIKit;
+
+#else
+using MonoTouch.UIKit;
+#endif
+
+namespace Xamarin.Forms.Platform.iOS
+{
+ internal class ModalWrapper : UIViewController
+ {
+ IVisualElementRenderer _modal;
+
+ internal ModalWrapper(IVisualElementRenderer modal)
+ {
+ _modal = modal;
+
+ View.BackgroundColor = UIColor.White;
+ View.AddSubview(modal.ViewController.View);
+ AddChildViewController(modal.ViewController);
+
+ modal.ViewController.DidMoveToParentViewController(this);
+ }
+
+ public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
+ {
+ return UIInterfaceOrientationMask.All;
+ }
+
+ public override void ViewDidLayoutSubviews()
+ {
+ base.ViewDidLayoutSubviews();
+ if (_modal != null)
+ _modal.SetElementSize(new Size(View.Bounds.Width, View.Bounds.Height));
+ }
+
+ public override void ViewWillAppear(bool animated)
+ {
+ View.BackgroundColor = UIColor.White;
+ base.ViewWillAppear(animated);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ _modal = null;
+ base.Dispose(disposing);
+ }
+ }
+
+ internal class PlatformRenderer : UIViewController
+ {
+ internal PlatformRenderer(Platform platform)
+ {
+ Platform = platform;
+ }
+
+ public Platform Platform { get; set; }
+
+ public override UIInterfaceOrientationMask GetSupportedInterfaceOrientations()
+ {
+ return UIInterfaceOrientationMask.All;
+ }
+
+ public override void ViewDidAppear(bool animated)
+ {
+ Platform.DidAppear();
+ base.ViewDidAppear(animated);
+ }
+
+ public override void ViewDidLayoutSubviews()
+ {
+ base.ViewDidLayoutSubviews();
+ Platform.LayoutSubviews();
+ }
+
+ public override void ViewWillAppear(bool animated)
+ {
+ View.BackgroundColor = UIColor.White;
+ Platform.WillAppear();
+ base.ViewWillAppear(animated);
+ }
+ }
+} \ No newline at end of file