void LayoutChildren(bool animated)
        {
            var    frame       = Element.Bounds.ToRectangleF();
            var    masterFrame = frame;
            nfloat opacity     = 1;

            masterFrame.Width = (int)(Math.Min(masterFrame.Width, masterFrame.Height) * 0.8);
            var detailRenderer = Platform.GetRenderer(MasterDetailPage.Detail);

            if (detailRenderer == null)
            {
                return;
            }
            var detailView = detailRenderer.ViewController.View;

            var isRTL = (Element as IVisualElementController)?.EffectiveFlowDirection.IsRightToLeft() == true;

            if (isRTL)
            {
                masterFrame.X = (int)(masterFrame.Width * .25);
            }

            _masterController.View.Frame = masterFrame;

            var target = frame;

            if (Presented)
            {
                target.X += masterFrame.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;
                UIView.SetAnimationCurve(UIViewAnimationCurve.EaseOut);
                UIView.SetAnimationDuration(250);
                UIView.CommitAnimations();
            }
            else
            {
                _detailController.View.Frame = target;
                detailView.Layer.Opacity     = (float)opacity;
            }

            MasterDetailPage.MasterBounds = new Rectangle(masterFrame.X, 0, masterFrame.Width, masterFrame.Height);
            MasterDetailPage.DetailBounds = new Rectangle(0, 0, frame.Width, frame.Height);

            if (Presented)
            {
                _clickOffView.Frame = _detailController.View.Frame;
            }
        }
Esempio n. 2
0
 public override UIViewController ChildViewControllerForStatusBarHidden()
 {
     return((UIViewController)Platform.GetRenderer(Platform.Page));
 }