// - (void)viewWillAppear:(BOOL)animated public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); if (!IsLeftMenuOpen() && !IsRightMenuOpen()) { contentViewController.View.Frame = View.Bounds; } contentViewController.BeginAppearanceTransition(true, animated); if (leftMenuViewController != null && leftMenuViewController.IsViewLoaded && leftMenuViewController.View.Superview != null) { leftMenuViewController.BeginAppearanceTransition(true, animated); } if (rightMenuViewController != null && rightMenuViewController.IsViewLoaded && rightMenuViewController.View.Superview != null) { rightMenuViewController.BeginAppearanceTransition(true, animated); } }
public void UpdateContent() { if (lastSize.Width != ContainerView.Bounds.Size.Width) { lastSize = ContainerView.Bounds.Size; ContainerView.ContentOffset = new CGPoint(PageOffsetForChildIndex(CurrentIndex), 0); } lastSize = ContainerView.Bounds.Size; var pagerViewControllers = pagerTabStripChildViewControllersForScrolling ?? ViewControllers; ContainerView.ContentSize = new CGSize(ContainerView.Bounds.Width * new nfloat(pagerViewControllers.Count()), ContainerView.ContentSize.Height); int pagerViewControllersCount = pagerViewControllers.Count(); for (int index = 0; index < pagerViewControllersCount; index++) { UIViewController childController = pagerViewControllers[index]; var pageOffsetForChild = PageOffsetForChildIndex((uint)index); if (Math.Abs(ContainerView.ContentOffset.X - pageOffsetForChild) < ContainerView.Bounds.Width) { if (childController.ParentViewController != null) { childController.View.Frame = new CGRect(OffsetForChildIndex((uint)index), 0, View.Bounds.Width, ContainerView.Bounds.Height); childController.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; } else { childController.BeginAppearanceTransition(true, animated: false); AddChildViewController(childController); childController.View.Frame = new CGRect(OffsetForChildIndex((uint)index), 0, View.Bounds.Width, ContainerView.Bounds.Height); childController.View.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; ContainerView.AddSubview(childController.View); childController.DidMoveToParentViewController(this); childController.EndAppearanceTransition(); } } else { if (childController.ParentViewController != null) { childController.BeginAppearanceTransition(false, animated: false); childController.WillMoveToParentViewController(null); childController.View.RemoveFromSuperview(); childController.RemoveFromParentViewController(); childController.EndAppearanceTransition(); } } } var oldCurrentIndex = CurrentIndex; var virtualPage = VirtualPageForContentOffset(ContainerView.ContentOffset.X); var newCurrentIndex = PageForVirtualPage(virtualPage); CurrentIndex = (uint)newCurrentIndex; var changeCurrentIndex = newCurrentIndex != oldCurrentIndex; IPagerTabStripIsProgressiveDelegate progressiveDelegate = this as IPagerTabStripIsProgressiveDelegate; if (progressiveDelegate != null && PagerBehaviour.IsProgressiveIndicator) { Tuple <int, int, nfloat> data = ProgressiveIndicatorData((uint)virtualPage); progressiveDelegate.PagerTabStripViewController(this, data.Item1, data.Item2, data.Item3, changeCurrentIndex); } else { Delegate?.PagerTabStripViewController(this, Math.Min((int)oldCurrentIndex, pagerViewControllers.Count() - 1), (int)newCurrentIndex); } }
private void ShowRightMenuViewController() { if (RightMenuViewController == null) { return; } RightMenuViewController.BeginAppearanceTransition(true, true); RightMenuViewController.View.Hidden = false; if (LeftMenuViewController != null) { LeftMenuViewController.View.Hidden = true; } View.Window.EndEditing(true); AddContentButton(); UpdateContentViewShadow(); ResetContentViewScale(); UIApplication.SharedApplication.BeginIgnoringInteractionEvents(); UIView.Animate(AnimationDuration, () => { if (ScaleContentView) { _contentViewContainer.Transform = CGAffineTransform.MakeScale(ContentViewScaleValue, ContentViewScaleValue); } else { _contentViewContainer.Transform = CGAffineTransform.MakeIdentity(); } var currentOrientation = UIApplication.SharedApplication.StatusBarOrientation; bool isPortrait = currentOrientation == UIInterfaceOrientation.Portrait || currentOrientation == UIInterfaceOrientation.PortraitUpsideDown; var centerPointX = isPortrait ? -ContentViewInPortraitOffsetCenterX : -ContentViewInLandscapeOffsetCenterX; var centerPointY = _contentViewContainer.Center.Y; _contentViewContainer.Center = new CGPoint(centerPointX, centerPointY); _menuViewContainer.Alpha = !FadeMenuView ? 0 : 1.0f; _contentViewContainer.Alpha = ContentViewFadeOutAlpha; _menuViewContainer.Transform = CGAffineTransform.MakeIdentity(); if (ScaleBackgroundImageView) { _backgroundImageView.Transform = CGAffineTransform.MakeIdentity(); } }, () => { RightMenuViewController.EndAppearanceTransition(); if (!_visible) { DidShowMenuViewController?.Invoke(this, RightMenuViewController); } _visible = !(_contentViewContainer.Frame.Width == View.Bounds.Width && _contentViewContainer.Frame.Height == View.Bounds.Height && _contentViewContainer.Frame.X == 0 && _contentViewContainer.Frame.Y == 0); RightMenuVisible = _visible; _menuState = MenuState.RightOpened; UIApplication.SharedApplication.EndIgnoringInteractionEvents(); AddContentViewControllerMotionEffects(); }); StatusBarNeedsAppearanceUpdate(); }