public UIViewController GetPreviousViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
        {
            var index = ViewControllers.IndexOf(referenceViewController) - 1;

            if (index < 0)
            {
                return(null);
            }

            return(ViewControllers[index]);
        }
示例#2
0
        public nfloat OffsetForChild(UIViewController viewController)
        {
            var index = ViewControllers.IndexOf(viewController);

            if (index > -1)
            {
                throw new ViewControllerNotContainedInPagerTabStrip();
            }

            return(OffsetForChild(index));
        }
        public UIViewController GetNextViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
        {
            var index = ViewControllers.IndexOf(referenceViewController) + 1;

            if (index == ViewControllers.Count)
            {
                return(null);
            }

            return(ViewControllers[index]);
        }
		void InsertPageBefore(Page page, Page before)
		{
			if (before == null)
				throw new ArgumentNullException("before");
			if (page == null)
				throw new ArgumentNullException("page");

			var pageContainer = CreateViewControllerForPage(page);
			var target = Platform.GetRenderer(before).ViewController.ParentViewController;
			ViewControllers = ViewControllers.Insert(ViewControllers.IndexOf(target), pageContainer);
		}
        void HandlePageViewControllerDidFinishAnimating(object sender, UIPageViewFinishedAnimationEventArgs e)
        {
            if (pageViewController.ViewControllers.Length == 0)
            {
                return;
            }

            SelectedViewController = pageViewController.ViewControllers[0];
            var index = ViewControllers.IndexOf(SelectedViewController);

            TabBar.SelectedIndex = index;
            lastSelectedIndex    = index;
        }
示例#6
0
        public new UIViewController GetNextViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
        {
            var index = ViewControllers.IndexOf(referenceViewController) + 1;

            //in the source, it is if (index == ViewControllers.Count) return null;
            //change here to if (index == ViewControllers.Count || index == 1) will fix the first tab
            if (index == ViewControllers.Count || index == 1)
            {
                return(null);
            }

            return(ViewControllers[index]);
        }
示例#7
0
        public new UIViewController GetPreviousViewController(UIPageViewController pageViewController, UIViewController referenceViewController)
        {
            var index = ViewControllers.IndexOf(referenceViewController) - 1;

            //in the source, it is if (index < 0) return null;
            //change here to if (index < 1) will fix the first tab


            if (index < 1)
            {
                return(null);
            }

            return(ViewControllers[index]);
        }
示例#8
0
        protected virtual void OnInsertRequested(NavigationRequestedEventArgs e)
        {
            var page   = e.Page;
            var before = e.BeforePage;

            var beforeRenderer = Platform.GetRenderer(before);

            var renderer = Platform.CreateRenderer(page);

            Platform.SetRenderer(page, renderer);

            var tracker = _context.CreatePageRendererTracker();

            tracker.ViewController = renderer.ViewController;
            tracker.Page           = page;

            _trackers[page] = tracker;

            ViewControllers.Insert(ViewControllers.IndexOf(beforeRenderer.ViewController), renderer.ViewController);
        }
示例#9
0
 public void MoveTo(UIViewController viewController, bool animated = true)
 {
     MoveToViewController(ViewControllers.IndexOf(viewController), animated);
 }