async void ShowSecond(bool animated) { if (ChildViewControllers.Contains(Second)) { return; } if (PresentedViewController != null) { await DismissViewControllerAsync(animated); } Second.View.Alpha = animated ? 0.0f : 1.0f; Splitter.Alpha = animated ? 0.0f : 1.0f; Second.ViewWillAppear(animated); AddChildViewController(Second); containerView.AddSubview(Second.View); containerView.AddSubview(Splitter); containerView.OnlyFirst = false; containerView.SetNeedsLayout(); if (animated) { await UIView.AnimateAsync(0.333, () => { Second.View.Alpha = 1.0f; Splitter.Alpha = 1.0f; containerView.LayoutIfNeeded(); }); } }
async void HideSecond(bool animated) { if (!ChildViewControllers.Contains(Second)) { return; } Second.ViewWillDisappear(animated); containerView.OnlyFirst = true; containerView.SetNeedsLayout(); if (animated) { await UIView.AnimateAsync(0.333, () => { Second.View.Alpha = 0.0f; Splitter.Alpha = 0.0f; containerView.LayoutIfNeeded(); }); } else { Second.View.Alpha = 0.0f; Splitter.Alpha = 0.0f; } Second.RemoveFromParentViewController(); Second.View.RemoveFromSuperview(); Splitter.RemoveFromSuperview(); containerView.SetNeedsLayout(); }