public static UIViewController CreateViewController(this Page page) { if (!Forms.IsInitialized) { throw new InvalidOperationException("call Forms.Init() before this"); } if (!(page.RealParent is Application)) { Application app = new EmbeddedApplication(); app.MainPage = page; } var result = new Platform.iOS.Platform(); result.SetPage(page); return(result.ViewController); }
void LayoutChildren(bool animated) { var frame = Element.Bounds.ToRectangleF(); var flyoutFrame = frame; nfloat opacity = 1; flyoutFrame.Width = (int)(Math.Min(flyoutFrame.Width, flyoutFrame.Height) * 0.8); var detailRenderer = Platform.GetRenderer(FlyoutPage.Detail); if (detailRenderer == null) { return; } var detailView = detailRenderer.ViewController.View; var isRTL = (Element as IVisualElementController)?.EffectiveFlowDirection.IsRightToLeft() == true; if (isRTL) { flyoutFrame.X = (int)(flyoutFrame.Width * .25); } _flyoutController.View.Frame = flyoutFrame; var target = frame; if (Presented) { target.X += flyoutFrame.Width; if (_applyShadow) { opacity = 0.5f; } } if (isRTL) { target.X = target.X * -1; } if (animated) { UIView.BeginAnimations("Flyout"); var view = _detailController.View; view.Frame = target; detailView.Layer.Opacity = (float)opacity; #pragma warning disable CA1416 // TODO: SetAnimationCurve(...), SetAnimationDuration(250), CommitAnimations() is unsupported on: 'ios' 13.0 and later UIView.SetAnimationCurve(UIViewAnimationCurve.EaseOut); UIView.SetAnimationDuration(250); UIView.CommitAnimations(); #pragma warning restore CA1416 } else { _detailController.View.Frame = target; detailView.Layer.Opacity = (float)opacity; } FlyoutPageController.FlyoutBounds = new Rect(flyoutFrame.X, 0, flyoutFrame.Width, flyoutFrame.Height); FlyoutPageController.DetailBounds = new Rect(0, 0, frame.Width, frame.Height); if (Presented) { _clickOffView.Frame = _detailController.View.Frame; } }