public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			modelController = new ModelController ();

			pageViewController = new UIPageViewController (
				UIPageViewControllerTransitionStyle.PageCurl,
				UIPageViewControllerNavigationOrientation.Horizontal,
				new NSDictionary ()
			);

			pageViewController.Delegate = this;
			DataViewController startingViewController = modelController.GetViewController (0, Storyboard);
			pageViewController.SetViewControllers (
				new [] { startingViewController },
				UIPageViewControllerNavigationDirection.Forward,
				false, null
			);

			pageViewController.DataSource = modelController;
			AddChildViewController (pageViewController);
			View.AddSubview (pageViewController.View);

			CGRect pageViewRect = View.Bounds;

			pageViewController.View.Frame = pageViewRect;
			pageViewController.DidMoveToParentViewController (this);
			View.GestureRecognizers = pageViewController.GestureRecognizers;
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			pageViewController = ChildViewControllers [0] as UIPageViewController;
			if (pageViewController == null)
				return;

			var startingViewController = DataSource.GetViewControllerAt (0);
			if (startingViewController == null)
				return;

			DataViewController[] viewControllers = { startingViewController };
			pageViewController.SetViewControllers (viewControllers, Forward, false, null);


			pageViewController.DataSource = DataSource;
			pageViewController.DidMoveToParentViewController (this);
		}
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			_pageTitles = new List<string> {"Explore", "Widget", "Navigation", "Random"};
			_images = new List<string> {"page1", "page2", "page3", "page4"};

			pageViewController = this.Storyboard.InstantiateViewController ("PageViewController") as UIPageViewController;
			pageViewController.DataSource = new PageViewControllerDataSource (this, _pageTitles);

			var startVC = this.ViewControllerAtIndex (0) as ContentViewController;
			var viewControllers = new UIViewController[] {startVC};

			pageViewController.SetViewControllers (viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
			pageViewController.View.Frame = new CGRect (0, 0, this.View.Frame.Width, this.View.Frame.Size.Height-50); 
			AddChildViewController (this.pageViewController);
			View.AddSubview (this.pageViewController.View);
			pageViewController.DidMoveToParentViewController (this);

			button.TouchUpInside += RestartTutorial;
		}
Ejemplo n.º 4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ModelController = new ModelController();

            // Configure the page view controller and add it as a child view controller.
            PageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
            PageViewController.WeakDelegate = this;

            var startingViewController = ModelController.GetViewController(0, Storyboard);
            var viewControllers        = new UIViewController[] { startingViewController };

            PageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);

            PageViewController.WeakDataSource = ModelController;

            AddChildViewController(PageViewController);
            View.AddSubview(PageViewController.View);

            // Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
            var pageViewRect = View.Bounds;

            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                pageViewRect = new CGRect(pageViewRect.X + 20, pageViewRect.Y + 20, pageViewRect.Width - 40, pageViewRect.Height - 40);
            }
            PageViewController.View.Frame = pageViewRect;

            PageViewController.DidMoveToParentViewController(this);

            // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
            View.GestureRecognizers = PageViewController.GestureRecognizers;
        }
Ejemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _pageTitles = new List <string> {
                "WELCOME", "DATA", "VOUCHERS"
            };
            _images = new List <string> {
                "Onboard-Portrait1.jpg", "Onboard-Portrait2.jpg", "Onboard-Portrait3.jpg"
            };

            pageViewController            = this.Storyboard.InstantiateViewController("PageViewController") as UIPageViewController;
            pageViewController.DataSource = new PageViewControllerDataSource(this, _pageTitles);

            var startVC         = this.ViewControllerAtIndex(0) as ContentViewController;
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
            pageViewController.View.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Size.Height);
            AddChildViewController(this.pageViewController);
            View.AddSubview(this.pageViewController.View);
            pageViewController.DidMoveToParentViewController(this);

            //button.TouchUpInside += RestartTutorial;
        }
Ejemplo n.º 6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            Title = Application.LocalizedString("GeneralHelp");
            if (!App.Locator.Login.GetSavedFirstLaunchTuto())
            {
                NavigationController.NavigationBarHidden = true;
            }

            _pageTitles = new List <string> {
                Application.LocalizedString("IMEIAndPinHelp")
                , Application.LocalizedString("CreditsHelp")
                , Application.LocalizedString("FirstUseHelp")
            };
            _images = new List <string> {
                "TutoAddSeekios", "TutoCredits", "TutoMode"
            };

            _pageViewController            = Storyboard.InstantiateViewController("PageViewController") as UIPageViewController;
            _pageViewController.DataSource = new TutorialBackgroundSource(this, _pageTitles);

            var startVC         = ViewControllerAtIndex(0) as TutorialForegroundView;
            var viewControllers = new UIViewController[] { startVC };

            _pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);
            _pageViewController.View.Frame = new CGRect(0, 0, View.Frame.Width, View.Frame.Size.Height - 42);
            AddChildViewController(_pageViewController);
            View.AddSubview(_pageViewController.View);
            _pageViewController.DidMoveToParentViewController(this);
            _pageViewController.WillTransition += PageViewController_WillTransition;

            ButtonSkip.TouchUpInside += ButtonSkip_TouchUpInside;
            ButtonSkip.SetTitle(Application.LocalizedString("SkipButton"), UIControlState.Normal);
        }
Ejemplo n.º 7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.BackgroundColor = this.style.PagesBackgroundColor;

            this.bar = new PagerBar(this.style)
            {
                Frame            = new CGRect(0, 0, this.View.Bounds.Width, this.style.BarHeight),
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin,
            };

            this.bar.Sections     = this.children.Select(vc => vc.Title).ToArray();
            this.bar.TabSelected += OnTabSelected;;

            this.View.AddSubview(bar);

            // Pager

            this.pager = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, UIPageViewControllerNavigationOrientation.Horizontal);
            this.pager.DidFinishAnimating += OnPageSwiped;
            this.pager.DataSource          = new PagerDataSource(children);
            this.pager.SetViewControllers(children.Take(1).ToArray(), UIPageViewControllerNavigationDirection.Forward, false, s => { });

            this.AddChildViewController(pager);
            pager.DidMoveToParentViewController(this);

            this.View.AddSubview(this.pager.View);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            SeparatelyShouldRefreshEndpoints = new List <bool> {
                true, true, true
            };

            PointsAndStatsButton.SetTitle("Points & Stats");
            LeaderboardButton.SetTitle("Leaderboard");
            TransactionsButton.SetTitle("Transactions");
            PointsAndStatsButton.SetSelected();

            UIStoryboard board = UIStoryboard.FromName("Main", null);

            pageViewController = board.InstantiateViewController("PointsPageViewController") as UIPageViewController;
            pageSource         = new PointsPageViewControllerDataSource(this);

            pageViewController.DataSource = pageSource;

            var startVC         = this.ViewControllerAtIndex(1) as PointsBaseViewController; //start on second page for glitch (should start on page index 0 without glitch)
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
            pageViewController.View.Frame = mainView.Bounds;
            AddChildViewController(this.pageViewController);
            mainView.AddSubview(this.pageViewController.View);
            pageViewController.DidMoveToParentViewController(this);

            CGRect frame = View.Frame;
        }
		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

			// Configure the page view controller and add it as a child view controller.
			PageViewController = new UIPageViewController (UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
			PageViewController.WeakDelegate = this;

			var startingViewController = ModelController.GetViewController (0, Storyboard);
			var viewControllers = new UIViewController[] { startingViewController };
			PageViewController.SetViewControllers (viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);

			PageViewController.WeakDataSource = ModelController;

			AddChildViewController (PageViewController);
			View.AddSubview (PageViewController.View);

			// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
			var pageViewRect = View.Bounds;
			pageViewRect = new RectangleF (pageViewRect.X + 20, pageViewRect.Y + 20, pageViewRect.Width - 40, pageViewRect.Height - 40);
			PageViewController.View.Frame = pageViewRect;

			PageViewController.DidMoveToParentViewController (this);

			// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
			View.GestureRecognizers = PageViewController.GestureRecognizers;
		}
Ejemplo n.º 10
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            modelController = new ModelController();

            pageViewController = new UIPageViewController(
                UIPageViewControllerTransitionStyle.PageCurl,
                UIPageViewControllerNavigationOrientation.Horizontal,
                new NSDictionary()
                );

            pageViewController.Delegate = this;
            DataViewController startingViewController = modelController.GetViewController(0, Storyboard);

            pageViewController.SetViewControllers(
                new [] { startingViewController },
                UIPageViewControllerNavigationDirection.Forward,
                false, null
                );

            pageViewController.DataSource = modelController;
            AddChildViewController(pageViewController);
            View.AddSubview(pageViewController.View);

            CGRect pageViewRect = View.Bounds;

            pageViewController.View.Frame = pageViewRect;
            pageViewController.DidMoveToParentViewController(this);
            View.GestureRecognizers = pageViewController.GestureRecognizers;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ConfigurePageViewController();

            View.TintColor       = UIColor.White;
            View.BackgroundColor = UIColor.Black;
            PageViewController.View.BackgroundColor = UIColor.Clear;

            PageViewController.View.AddGestureRecognizer(PanGestureRecognizer);
            PageViewController.View.AddGestureRecognizer(SingleTapGestureRecognizer);

            AddChildViewController(PageViewController);
            View.AddSubview(PageViewController.View);
            PageViewController.DidMoveToParentViewController(this);

            AddOverlayView();

            TransitionController.StartingView = ReferenceViewForCurrentPhoto;

            UIView endingView = null;

            if (CurrentlyDisplayedPhoto.Image != null || CurrentlyDisplayedPhoto.PlaceholderImage != null)
            {
                endingView = CurrentPhotoViewController.ScalingImageView.ImageView;
            }

            TransitionController.EndingView = endingView;
        }
Ejemplo n.º 12
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _pageTitles = new List <string> {
                "Explore", "Widget", "Navigation", "Random"
            };
            _images = new List <string> {
                "page1", "page2", "page3", "page4"
            };

            pageViewController            = this.Storyboard.InstantiateViewController("PageViewController") as UIPageViewController;
            pageViewController.DataSource = new PageViewControllerDataSource(this, _pageTitles);

            var startVC         = this.ViewControllerAtIndex(0) as ContentViewController;
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
            pageViewController.View.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Size.Height - 50);
            AddChildViewController(this.pageViewController);
            View.AddSubview(this.pageViewController.View);
            pageViewController.DidMoveToParentViewController(this);

            button.TouchUpInside += RestartTutorial;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.AddSubview(TabBar);

            AddChildViewController(pageViewController);
            View.AddSubview(pageViewController.View);
            pageViewController.View.TranslatesAutoresizingMaskIntoConstraints = false;
            pageViewController.DidMoveToParentViewController(this);


            var views = NSDictionary.FromObjectsAndKeys(
                new NSObject[] {
                TabBar,
                pageViewController.View
            },
                new NSObject[] {
                (NSString)"tabbar",
                (NSString)"content"
            }
                );

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[tabbar]-0-[content]-0-|",
                                                                    0,
                                                                    null,
                                                                    views));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[tabbar]-0-|",
                                                                    0,
                                                                    null,
                                                                    views));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[content]-0-|",
                                                                    0,
                                                                    null,
                                                                    views));


            tabBarHeight = NSLayoutConstraint.Create(
                TabBar,
                NSLayoutAttribute.Height,
                NSLayoutRelation.Equal,
                1, 68
                );
            TabBar.AddConstraint(tabBarHeight);

            if (pageViewController.ViewControllers.Length == 0 &&
                lastSelectedIndex >= 0 && lastSelectedIndex < ViewControllers.Count)
            {
                pageViewController.SetViewControllers(
                    new[] { ViewControllers[lastSelectedIndex] },
                    UIPageViewControllerNavigationDirection.Forward,
                    true, null
                    );
            }

            UpdateSwipe(Tabbed.SwipeEnabled);
            pageViewController.DidFinishAnimating += HandlePageViewControllerDidFinishAnimating;
        }
Ejemplo n.º 14
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            const int buttonHeight = 50;

            var pagerSurload = new UIPageControl
            {
                Frame = new CGRect(0, UIScreen.MainScreen.Bounds.Height - buttonHeight - buttonHeight, UIScreen.MainScreen.Bounds.Width, buttonHeight),
                Pages = 4
            };

            var pvController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, UIPageViewControllerNavigationOrientation.Horizontal);
            var pages        = new List <StartupPageFeatureViewController>();
            int index        = 0;

            pages.Add(new StartupPageFeatureViewController(
                          Core.Resources.StringValues.Startup_FlipViewItem1_Title_Text,
                          Core.Resources.StringValues.Startup_FlipViewItem1_Content_Text,
                          index++));

            pages.Add(new StartupPageFeatureViewController(
                          Core.Resources.StringValues.Startup_FlipViewItem2_Title_Text,
                          Core.Resources.StringValues.Startup_FlipViewItem2_Content_Text,
                          index++));

            pages.Add(new StartupPageFeatureViewController(
                          Core.Resources.StringValues.Startup_FlipViewItem3_Title_Text,
                          Core.Resources.StringValues.Startup_FlipViewItem3_Content_Text,
                          index++));

            pages.Add(new StartupPageFeatureViewController(
                          Core.Resources.StringValues.Startup_FlipViewItem4_Title_Text,
                          Core.Resources.StringValues.Startup_FlipViewItem4_Content_Text,
                          index++));

            pvController.DataSource = new PageDataSource(pages, pagerSurload);
            pvController.View.Frame = new CGRect(0, 0, View.Bounds.Width, View.Bounds.Height - buttonHeight);
            pvController.SetViewControllers(new UIViewController[] { pages[0], }, UIPageViewControllerNavigationDirection.Forward, false, s => { });

            AddChildViewController(pvController);
            View.AddSubview(pvController.View);
            pvController.DidMoveToParentViewController(this);

            View.AddSubview(pagerSurload);

            var connectButton = new UIButton
            {
                Frame           = new CGRect(0, UIScreen.MainScreen.Bounds.Height - buttonHeight, UIScreen.MainScreen.Bounds.Width, buttonHeight),
                BackgroundColor = ApplicationColors.MainColor
            };

            connectButton.SetTitle(Core.Resources.StringValues.Startup_ConnectionButton_Text, UIControlState.Normal);
            View.AddSubview(connectButton);
            connectButton.SetCommand(ViewModel.GoToNextPageCommand);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Calls after the controller’s view did loaded into memory.
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Load document
            PDFDocument.OpenDocument(_DocumentName, _DocumentPath);

            // Init View
            Title = _DocumentName;
            View.BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor;
            _AutoScaleMode       = MgrAccessor.OptionsMgr.Options.AutoScaleMode;

            // Create toolbar
            if (MgrAccessor.OptionsMgr.Options.ToolbarVisible)
            {
                _Toolbar = _CreateToolbar();
                View.AddSubview(_Toolbar);
            }

            // Create bottom bar (with slider)
            if (MgrAccessor.OptionsMgr.Options.BottombarVisible)
            {
                _BottomBar = _CreateBottomBar();
                View.AddSubview(_BottomBar);
                // Update Slider Max value
                _UpdateSliderMaxValue();
            }

            // Create the book PageView controller
            _BookPageViewController = new UIPageViewController(
                MgrAccessor.OptionsMgr.Options.PageTransitionStyle,
                MgrAccessor.OptionsMgr.Options.PageNavigationOrientation,
                UIPageViewControllerSpineLocation.Min);
            _BookPageViewController.View.Frame                = _GetBookViewFrameRect();
            _BookPageViewController.View.AutoresizingMask     = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            _BookPageViewController.View.BackgroundColor      = UIColor.GroupTableViewBackgroundColor;
            _BookPageViewController.GetNextViewController     = GetNextPageViewController;
            _BookPageViewController.GetPreviousViewController = GetPreviousPageViewController;
            _BookPageViewController.GetSpineLocation          = GetSpineLocation;
            _BookPageViewController.DidFinishAnimating       += delegate(object sender, UIPageViewFinishedAnimationEventArgs e) {
                PageFinishedAnimation(e.Completed, e.Finished, e.PreviousViewControllers);
            };
            _BookPageViewController.SetViewControllers(
                new UIViewController[] { GetPageViewController(1) },
                UIPageViewControllerNavigationDirection.Forward,
                false,
                s => ExecAfterOpenPageActions());

            AddChildViewController(_BookPageViewController);
            _BookPageViewController.DidMoveToParentViewController(this);
            View.AddSubview(_BookPageViewController.View);
        }
Ejemplo n.º 16
0
        public void initChapterViewController(PageController page)
        {
            if (chapterVC == null)
            {
                //initial chapterVC
                ChapterViewController.pages = secondScroll.pagesController;
                chapterVC                     = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
                chapterVC.DataSource          = new ChapterViewController.ChapterVCDataSource();
                chapterVC.View.Frame          = Constants.mainFrame;
                chapterVC.DidFinishAnimating += (sender, e) => {
                    if (e.Finished)
                    {
                        if (e.Completed)
                        {
                            foreach (ChapterViewController c in e.PreviousViewControllers)
                            {
                                this.secondScroll.view.AddSubview(c.currentPage.smallImage);
                                c.currentPage.smallImageToPosition(secondScroll, this.currentChapter.pagesStartX);
                                var currentVC = (ChapterViewController)chapterVC.ViewControllers [chapterVC.ViewControllers.Length - 1];
                                currentVC.currentPage.smallImage.Hidden = true;
                                Console.WriteLine("current + " + currentVC.currentPage.pageInfo.chapter + "   prev " + c.currentPage.pageInfo.chapter);
                                if (currentVC.currentPage.pageInfo.chapter != c.currentPage.pageInfo.chapter)
                                {
                                    Console.WriteLine("chapterchanged");
                                    int chapter = currentVC.currentPage.pageInfo.chapter;
                                    this.currentPage    = chapter;
                                    this.currentChapter = this.chaptersController [chapter];
                                    this.drawCurrentChapter();
                                }

                                fixSecondScrollPosition(currentVC.currentPage);
                            }
                        }
                    }
                };
            }

            ChapterViewController contentViewController = new ChapterViewController(page);

            var viewControllers = new List <ChapterViewController>();

            viewControllers.Add(contentViewController);
            chapterVC.SetViewControllers(viewControllers.ToArray(), UIPageViewControllerNavigationDirection.Forward, false, null);

            this.AddChildViewController(this.chapterVC);
            chapterVC.DidMoveToParentViewController(this);
            this.View.AddSubview(chapterVC.View);
            this.chapterScroll.UserInteractionEnabled = false;
            this.secondScroll.UserInteractionEnabled  = false;
        }
Ejemplo n.º 17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            PDFDocument.OpenDocument(_documentName, _documentPath);

            Title = _documentName;
            View.BackgroundColor = UIColor.Clear;
            _autoScaleMode       = MgrAccessor.SettingsMgr.Settings.AutoScaleMode;

            if (MgrAccessor.SettingsMgr.Settings.TopToolbarVisible)
            {
                _topToolbar = createTopToolbar();
                _topToolbar.BackgroundColor = UIColor.Clear;
                View.AddSubview(_topToolbar);
            }

            if (MgrAccessor.SettingsMgr.Settings.BottomToolbarVisible)
            {
                _bottomToolbar = createBottomToolbar();
                _bottomToolbar.BackgroundColor = UIColor.Clear;
                View.AddSubview(_bottomToolbar);
                updateSliderMaxValue();
            }

            _bookPageViewController = new UIPageViewController(
                MgrAccessor.SettingsMgr.Settings.PageTransitionStyle,
                MgrAccessor.SettingsMgr.Settings.PageNavigationOrientation,
                UIPageViewControllerSpineLocation.Min);
            _bookPageViewController.View.Frame                = getBookViewFrameRect();
            _bookPageViewController.View.AutoresizingMask     = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            _bookPageViewController.View.BackgroundColor      = UIColor.GroupTableViewBackgroundColor;
            _bookPageViewController.GetNextViewController     = getNextPageViewController;
            _bookPageViewController.GetPreviousViewController = getPreviousPageViewController;
            _bookPageViewController.GetSpineLocation          = getSpineLocation;
            _bookPageViewController.DidFinishAnimating       += delegate(object sender, UIPageViewFinishedAnimationEventArgs e) {
                pageFinishedAnimation(e.Completed, e.Finished, e.PreviousViewControllers);
            };
            _bookPageViewController.SetViewControllers(
                new UIViewController [] { getPageViewController(1) },
                UIPageViewControllerNavigationDirection.Forward,
                false,
                s => execActionsAfterOpenPage());

            AddChildViewController(_bookPageViewController);
            _bookPageViewController.DidMoveToParentViewController(this);
            View.AddSubview(_bookPageViewController.View);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            AVAudioSession.SharedInstance().SetCategory(AVAudioSessionCategory.Ambient);
            AVAudioSession.SharedInstance().SetActive(true);
            UIApplication.SharedApplication.BeginReceivingRemoteControlEvents();

            ApplyStyle();

            UIStoryboard board = UIStoryboard.FromName("Intro", null);

            pageViewController            = board.InstantiateViewController("IntroPageViewController") as UIPageViewController;
            dataSource                    = new IntroPageViewControllerDataSource(this);
            pageViewController.DataSource = dataSource;

            var startVC         = this.ViewControllerAtIndex(0) as IntroBaseViewController; //start on second page for glitch (should start on page index 0 without glitch)
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
            pageViewController.View.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Size.Height);
            AddChildViewController(this.pageViewController);
            View.AddSubview(this.pageViewController.View);
            pageViewController.DidMoveToParentViewController(this);

            UpdateViews();
            View.BringSubviewToFront(btn_Next);
            btn_Next.TouchUpInside += (s, e) =>
            {
                Traverse();
            };

            dataSource.ChangePage += (s, e) =>
            {
                var index = (int)s;
                ChangeProgressViewValue(index);
            };

            View.BringSubviewToFront(LoginButton);
        }
Ejemplo n.º 19
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // insantiate our ModelController
            modelController = new ModelController();

            // Do any additional setup after loading the view, typically from a nib.
            // Configure the page view controller and add it as a child view controller.

            pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl,
                                                          UIPageViewControllerNavigationOrientation.Horizontal,
                                                          new NSDictionary());
            pageViewController.Delegate = this;

            var startingViewController = modelController.GetViewController(0, Storyboard);

            pageViewController.SetViewControllers(new[] { startingViewController },
                                                  UIPageViewControllerNavigationDirection.Forward,
                                                  false,
                                                  null);

            pageViewController.DataSource = modelController;

            AddChildViewController(pageViewController);
            View.AddSubview(pageViewController.View);

            // Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
            var pageViewRect = View.Bounds;

            pageViewController.View.Frame = pageViewRect;
            pageViewController.DidMoveToParentViewController(this);

            // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
            View.GestureRecognizers = pageViewController.GestureRecognizers;
        }
Ejemplo n.º 20
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            pageViewController = ChildViewControllers [0] as UIPageViewController;
            if (pageViewController == null)
            {
                return;
            }

            var startingViewController = DataSource.GetViewControllerAt(0);

            if (startingViewController == null)
            {
                return;
            }

            DataViewController[] viewControllers = { startingViewController };
            pageViewController.SetViewControllers(viewControllers, Forward, false, null);


            pageViewController.DataSource = DataSource;
            pageViewController.DidMoveToParentViewController(this);
        }
Ejemplo n.º 21
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            tabBarView.Hidden = true;
            UIStoryboard board = UIStoryboard.FromName("Main", null);

            pageViewController = board.InstantiateViewController("PointsPageViewController") as UIPageViewController;
            pageSource         = new RewardsPageViewControllerDataSource(this);

            pageViewController.DataSource = pageSource;

            var startVC         = this.ViewControllerAtIndex(1) as RewardsBaseViewController; //start on second page for glitch (should start on page index 0 without glitch)
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
            //pageViewController.View.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Size.Height - 50);
            pageViewController.View.Frame = mainView.Frame;

            AddChildViewController(this.pageViewController);
            mainView.AddSubview(this.pageViewController.View);
            pageViewController.DidMoveToParentViewController(this);

            //startVC.ShowAreaCollection();
            //startVC.HideAreaCollection();
            //PrevPage();

            pageSource.ChangePage += (s, e) =>
            {
                var index = (int)s;
                ChangeSelectedButton(index);
            };
            AllRewardsButton.SetTitle("All Rewards");
            AviableRewardsButton.SetTitle("Aviable");
            ClaimedButton.SetTitle("Claimed");
            AllRewardsButton.SetSelected();
        }
Ejemplo n.º 22
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            //this.ShowIntroWithCrossDissolve();

            _pageTitles = new List <string> {
                "Explore", "Widget", "Navigation"
            };
            _images = new List <string> {
                "screen1", "screen2", "screen3"
            };


            //var pageController = UIPageControl.Appearance;
            //pageController.PageIndicatorTintColor = UIColor.Red;
            //pageController.CurrentPageIndicatorTintColor = UIColor.Red;
            //pageController.BackgroundColor = UIColor.DarkGray;

            pageViewController            = this.Storyboard.InstantiateViewController("IntroPageViewController") as UIPageViewController;
            pageViewController.DataSource = new PageViewControllerDataSource(this, _pageTitles);

            var startVC         = this.ViewControllerAtIndex(0) as IntroContentViewController;
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
            pageViewController.View.Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Size.Height);
            AddChildViewController(this.pageViewController);
            View.AddSubview(this.pageViewController.View);
            pageViewController.DidMoveToParentViewController(this);

            var btnWidth = (this.View.Bounds.Width / 2) - 20;

            buttonSignUp = new UIButton(UIButtonType.Custom)
            {
                BackgroundColor = UIColor.Clear
            };
            buttonSignUp.SetTitle("Sign Up", UIControlState.Normal);
            buttonSignUp.SetTitleColor(UIColor.White, UIControlState.Normal);
            buttonSignUp.Layer.BorderColor  = UIColor.White.CGColor;
            buttonSignUp.Layer.BorderWidth  = 1;
            buttonSignUp.Layer.CornerRadius = 2f;

            buttonSignUp.Frame          = new CGRect(this.View.Bounds.GetMidX() - (btnWidth + 5), this.View.Bounds.GetMaxY() - 50, btnWidth, 30);
            buttonSignUp.TouchUpInside += Signup;
            this.View.AddSubview(buttonSignUp);

            buttonLogin = new UIButton(UIButtonType.Custom)
            {
                BackgroundColor = UIColor.Clear
            };
            buttonLogin.SetTitle("Login", UIControlState.Normal);
            buttonLogin.SetTitleColor(UIColor.White, UIControlState.Normal);
            buttonLogin.Layer.BorderColor  = UIColor.White.CGColor;
            buttonLogin.Layer.BorderWidth  = 1;
            buttonLogin.Layer.CornerRadius = 2f;


            buttonLogin.Frame          = new CGRect(this.View.Bounds.GetMidX() + 5, this.View.Bounds.GetMaxY() - 50, btnWidth, 30);
            buttonLogin.TouchUpInside += Login;
            this.View.AddSubview(buttonLogin);
            this.View.Layer.BackgroundColor = UIColor.Clear.CGColor;

            pageControl             = new UIPageControl(new CGRect(this.View.Bounds.GetMidX() - 50, this.View.Bounds.GetMaxY() - 80, 100, 20));
            pageControl.Pages       = 3;
            pageControl.CurrentPage = 0;
            this.View.AddSubview(pageControl);
        }
Ejemplo n.º 23
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var backgroundImageView = new UIImageView
            {
                Frame = new CGRect(0, 0, this.View.Frame.Width, this.View.Frame.Height),
                Image = UIImage.FromBundle("TutorialBackground")
            };

            pageImages = new List <string> {
                "TutorialPage1", "TutorialPage2", "TutorialPage3", "TutorialPage4"
            };

            pageViewController            = this.Storyboard.InstantiateViewController("PageViewController") as UIPageViewController;
            pageViewController.DataSource = new TutorialPageViewControllerDataSource(this, pageImages);

            var startVC         = this.ViewControllerAtIndex(0) as TutorialContentPageViewController;
            var viewControllers = new UIViewController[] { startVC };

            pageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

            // Set appearance of buttons and page control on TutorialViewController
            int buttonHeight = 39;
            int buttonSpace  = 20;

            var logInTutorialButton = new UIButton()
            {
                Frame = new CGRect(buttonSpace, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace, UIScreen.MainScreen.Bounds.Size.Width / 2 - buttonSpace - buttonSpace / 2, buttonHeight),
            };

            logInTutorialButton.SetTitle("Log In", UIControlState.Normal);
            logInTutorialButton.TitleLabel.Font    = UIFont.SystemFontOfSize(16);
            logInTutorialButton.Layer.BorderWidth  = 0.5f;
            logInTutorialButton.Layer.CornerRadius = 5;
            logInTutorialButton.Layer.BorderColor  = UIColor.DarkGray.CGColor;
            logInTutorialButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            logInTutorialButton.SetTitleColor(UIColor.FromWhiteAlpha(0.8f, 0.2f), UIControlState.Highlighted);

            var signUpTutorialButton = new UIButton()
            {
                Frame = new CGRect(logInTutorialButton.Layer.Frame.GetMaxX() + buttonSpace, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace, UIScreen.MainScreen.Bounds.Size.Width / 2 - buttonSpace - buttonSpace / 2, buttonHeight),
            };

            signUpTutorialButton.SetTitle("Sign Up", UIControlState.Normal);
            signUpTutorialButton.TitleLabel.Font    = UIFont.SystemFontOfSize(16);
            signUpTutorialButton.Layer.BorderWidth  = 0.5f;
            signUpTutorialButton.Layer.CornerRadius = 5;
            signUpTutorialButton.Layer.BorderColor  = UIColor.DarkGray.CGColor;
            signUpTutorialButton.SetTitleColor(UIColor.FromRGB(214, 93, 98), UIControlState.Normal);
            signUpTutorialButton.SetTitleColor(UIColor.FromWhiteAlpha(0.8f, 0.2f), UIControlState.Highlighted);

            int pageControlWidth    = 7;
            var tutorialPageControl = new UIPageControl()
            {
                Frame = new CGRect(UIScreen.MainScreen.Bounds.Size.Width / 2 - pageControlWidth / 2, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace - 40, pageControlWidth, 0)
            };

            tutorialPageControl.Pages = pageImages.Count();
            tutorialPageControl.PageIndicatorTintColor        = UIColor.White;
            tutorialPageControl.CurrentPageIndicatorTintColor = UIColor.FromRGB(214, 93, 98);
            tutorialPageControl.CurrentPage = 0;

            int nextPageButtonSize     = 40;
            var nextPageTutorialButton = new UIButton()
            {
                Frame = new CGRect(UIScreen.MainScreen.Bounds.Size.Width / 2 - nextPageButtonSize / 2, UIScreen.MainScreen.Bounds.Size.Height - buttonHeight - buttonSpace - 40 * 2 - nextPageButtonSize, nextPageButtonSize, nextPageButtonSize)
            };

            nextPageTutorialButton.SetImage(UIImage.FromBundle("StartTutorialButton").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);

            AddChildViewController(this.pageViewController);

            View.AddSubviews(backgroundImageView, this.pageViewController.View, nextPageTutorialButton, tutorialPageControl, signUpTutorialButton, logInTutorialButton);

            pageViewController.DidMoveToParentViewController(this);

            // Getting index of the current page to change pageControl
            pageViewController.DidFinishAnimating += delegate(object sender, UIPageViewFinishedAnimationEventArgs e)
            {
                if (e.Completed)
                {
                    var currentVC = pageViewController.ViewControllers.First() as TutorialContentPageViewController;
                    tutorialPageControl.CurrentPage = currentVC.pageIndex;

                    if (currentVC.pageIndex == pageImages.Count() - 1)
                    {
                        nextPageTutorialButton.Hidden = true;
                    }
                    else
                    {
                        nextPageTutorialButton.Hidden = false;
                    }
                }
            };

            // Next Page button
            nextPageTutorialButton.TouchUpInside += (sender, e) =>
            {
                var currentVC    = pageViewController.ViewControllers.First() as TutorialContentPageViewController;
                var currentIndex = currentVC.pageIndex;

                if (currentIndex < pageImages.Count() - 1)
                {
                    var nextVC = this.ViewControllerAtIndex(currentIndex + 1) as TutorialContentPageViewController;
                    pageViewController.SetViewControllers(new UIViewController[] { nextVC }, UIPageViewControllerNavigationDirection.Forward, true, null);
                    tutorialPageControl.CurrentPage = currentIndex + 1;

                    // Hide button "next" on the last page
                    if (currentIndex == pageImages.Count() - 2)
                    {
                        nextPageTutorialButton.Hidden = true;
                    }
                }
            };

            // Launch Login View Controller
            logInTutorialButton.TouchUpInside += (sender, e) =>
            {
                var loginController = this.Storyboard.InstantiateViewController("LoginUserViewController") as LoginUserViewController;
                if (loginController != null)
                {
                    this.PresentViewController(loginController, true, null);
                }
            };

            // Launch Register View Controller
            signUpTutorialButton.TouchUpInside += (sender, e) =>
            {
                var registerController = this.Storyboard.InstantiateViewController("EnterNameRegisterUser") as RegisterUserViewController;
                if (registerController != null)
                {
                    var navigationController = new UINavigationController(registerController);
                    this.PresentViewController(navigationController, true, null);
                }
            };
        }
        /// <summary>
        /// Calls after the controller’s view did loaded into memory.
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Load document
            PDFDocument.OpenDocument(_DocumentName, _DocumentPath);

            // Init View
            Title = _DocumentName;
            View.BackgroundColor = UIColor.ScrollViewTexturedBackgroundColor;

            // Create toolbar
            if (MgrAccessor.OptionsMgr.Options.ToolbarVisible) {
                _Toolbar = CreateToolbar();
                if (_Toolbar != null) {
                    View.AddSubview(_Toolbar);
                }
            }

            // Create bottom bar (with slider)
            if (MgrAccessor.OptionsMgr.Options.BottombarVisible) {
                _BottomBar = CreateBottomBar();
                if (_BottomBar != null) {
                    View.AddSubview(_BottomBar);
                } else {
                    if (_Slider != null) {
                        _Slider.RemoveFromSuperview();
                        _Slider.Dispose();
                    }
                    if (_PageNumberLabel != null) {
                        _PageNumberLabel.RemoveFromSuperview();
                        _PageNumberLabel.Dispose();
                    }
                }
            }

            // Update Slider Max value
            UpdateSliderMaxValue();

            // Create the book PageView controller
            _BookPageViewController = new UIPageViewController(
                MgrAccessor.OptionsMgr.Options.PageTransitionStyle,
                MgrAccessor.OptionsMgr.Options.PageNavigationOrientation,
                UIPageViewControllerSpineLocation.Min);
            _BookPageViewController.View.Frame = GetBookPageViewFrameRect();
            _BookPageViewController.View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            _BookPageViewController.View.BackgroundColor = UIColor.GroupTableViewBackgroundColor;
            _BookPageViewController.GetNextViewController = GetNextPageViewController;
            _BookPageViewController.GetPreviousViewController = GetPreviousPageViewController;
            _BookPageViewController.GetSpineLocation = GetSpineLocation;
            _BookPageViewController.DidFinishAnimating += delegate(object sender, UIPageViewFinishedAnimationEventArgs e) {
                PageFinishedAnimation(e.Completed, e.Finished, e.PreviousViewControllers);
            };
            _BookPageViewController.SetViewControllers(
                new UIViewController[] { GetPageViewController(1) },
                UIPageViewControllerNavigationDirection.Forward,
                false,
                s => ExecAfterOpenPageActions());

            AddChildViewController(_BookPageViewController);
            _BookPageViewController.DidMoveToParentViewController(this);
            View.AddSubview(_BookPageViewController.View);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            if (this.TabBarController != null)
            {
                this.TabBarController.TabBar.Hidden = true;
            }



            //Ensure database refresh
            //this.NavigationItem.SetRightBarButtonItem(
            var refreshButton = new UIBarButtonItem(UIBarButtonSystemItem.Refresh, async(sender, args) =>
            {
                if (Reachability.IsHostReachable(Settings._baseDomain))
                {
                    LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame);
                    this.View.AddSubview(loadingIndicator);
                    // button was clicked
                    List <Ad> adList = new List <Ad>();


                    Ad.DeleteAdsByClassification(SelectedClassification);
                    adList = (await Ad.GetAdsByClassificationAsync(SelectedClassification)).ToList();


                    this.ModelController.LoadModalController(adList, SelectedClassification);

                    var firstViewController = ModelController.GetViewController(0, false);
                    var viewControllerArray = new UIViewController[] { firstViewController };
                    PageViewController.SetViewControllers(viewControllerArray, UIPageViewControllerNavigationDirection.Forward, true, null);

                    loadingIndicator.Hide();
                }
                else
                {
                    HelperMethods.SendBasicAlert("Connect to a Network", "Please connect to a network to refresh these ads");
                }
            });
            //, true);

            //start implementing search feature
            var searchButton = new UIBarButtonItem(UIBarButtonSystemItem.Search, (sender, e) =>
            {
                var errorMessage = "";
                if (ModelController != null && ModelController.adList != null && ModelController.adList.Count > 0)
                {
                    var adList = ModelController.adList;

                    SearchResultsViewController searchResultsViewController = new SearchResultsViewController();

                    searchResultsViewController.SearchResultsAdList = adList;
                    searchResultsViewController.Classification      = SelectedClassification;
                    searchResultsViewController.AdSelectedAction    = delegate
                    {
                        var pageViewController         = this.PageViewController;
                        var magFlipBoardViewController = this;



                        Ad ad = new Ad();

                        ad = searchResultsViewController.SelectedAd;

                        LoadingOverlay loadingIndicator = new LoadingOverlay(this.View.Frame, "Loading Aircraft");
                        this.View.AddSubview(loadingIndicator);

                        var modelController     = this.ModelController;
                        List <Ad> searchAddList = new List <Ad>();

                        Task.Run(async() =>
                        {
                            searchAddList = (await Ad.GetAdsByClassificationAsync(ad.Classification)).ToList();

                            //get ads with this name and move them to the from of the liste
                            List <Ad> similarAdList = new List <Ad>();

                            similarAdList = searchAddList.Where(row => row.Name == ad.Name).OrderBy(r => r.IsFeatured).ToList();

                            //similarAdList.Remove(ad);


                            for (int i = 0; i < similarAdList.Count(); i++)
                            {
                                searchAddList.Remove(similarAdList[i]);
                                searchAddList.Insert(0, similarAdList[i]);
                            }

                            //similarAdList.Remove(ad);
                            //searchAddList.Insert(0, ad);


                            var index            = searchAddList.FindIndex(x => x.ID == ad.ID);
                            var item             = searchAddList[index];
                            searchAddList[index] = searchAddList[0];
                            searchAddList[0]     = item;

                            InvokeOnMainThread(() =>
                            {
                                modelController.LoadModalController(searchAddList, ad.Classification);
                                loadingIndicator.Hide();
                                var initialViewController = modelController.GetViewController(0, false);
                                var searchViewControllers = new UIViewController[] { initialViewController };
                                pageViewController.SetViewControllers(searchViewControllers, UIPageViewControllerNavigationDirection.Forward, true, null);

                                HelperMethods.SendBasicAlert("", "Aircraft arranged based on search selection");
                            });
                        });
                    };
                    this.PresentViewController(searchResultsViewController, true, null);
                }
                else
                {
                    errorMessage = "Oops... There was a problem. Aircraft ads are not yet loaded.";
                }
                if (errorMessage != string.Empty)
                {
                    HelperMethods.SendBasicAlert("Alert", errorMessage);
                }
            });


            List <UIBarButtonItem> navButtonList = new List <UIBarButtonItem>();

            navButtonList.Add(searchButton);
            navButtonList.Add(refreshButton);


            this.NavigationItem.SetRightBarButtonItems(navButtonList.ToArray(), true);

            ModelController = new ModelController(SelectedClassification);

            // Configure the page view controller and add it as a child view controller.
            //UIPageViewControllerSpineLocation.Min
            PageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
            PageViewController.WeakDelegate = this;

            var startingViewController = ModelController.GetViewController(0, false);
            var viewControllers        = new UIViewController[] { startingViewController };

            PageViewController.SetViewControllers(viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);

            PageViewController.WeakDataSource = ModelController;

            AddChildViewController(PageViewController);
            View.AddSubview(PageViewController.View);

            UINavigationController magazineNavigationController = (UINavigationController)Storyboard.InstantiateViewController("MagazineNavigationViewController");
            float heightTopNavBar      = (float)magazineNavigationController.NavigationBar.Frame.Size.Height;
            float statusBarHeight      = (float)UIApplication.SharedApplication.StatusBarFrame.Height;
            float totalStatusBarHeight = heightTopNavBar + statusBarHeight;
            var   pageViewRect         = new CGRect(0, totalStatusBarHeight, View.Bounds.Width, View.Bounds.Height - totalStatusBarHeight);

            PageViewController.View.Frame = pageViewRect;

            PageViewController.DidMoveToParentViewController(this);

            // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
            //View.GestureRecognizers = PageViewController.GestureRecognizers;

            if (NavigateDirectlyToAdId != null && NavigateDirectlyToAdId != string.Empty)
            {
                LoadingIndicator = new LoadingOverlay(this.View.Frame, "Loading Aircraft", false);
                this.View.AddSubview(LoadingIndicator);
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            View.AddSubview(TabBar);

            AddChildViewController(pageViewController);
            View.AddSubview(pageViewController.View);
            pageViewController.View.TranslatesAutoresizingMaskIntoConstraints = false;
            pageViewController.DidMoveToParentViewController(this);

            var layoutAttributes = new[]
            {
                NSLayoutAttribute.Leading,
                NSLayoutAttribute.Trailing
            };

            for (int i = 0; i < layoutAttributes.Length; i++)
            {
                View.AddConstraint(NSLayoutConstraint.Create(
                                       TabBar,
                                       layoutAttributes[i],
                                       NSLayoutRelation.Equal,
                                       View,
                                       layoutAttributes[i],
                                       1, 0
                                       ));
                View.AddConstraint(NSLayoutConstraint.Create(
                                       pageViewController.View,
                                       layoutAttributes[i],
                                       NSLayoutRelation.Equal,
                                       View,
                                       layoutAttributes[i],
                                       1, 0
                                       ));
            }

            View.AddConstraint(NSLayoutConstraint.Create(
                                   pageViewController.View,
                                   NSLayoutAttribute.Bottom,
                                   NSLayoutRelation.Equal,
                                   View,
                                   NSLayoutAttribute.Bottom,
                                   1, 0
                                   ));

            View.AddConstraint(NSLayoutConstraint.Create(
                                   TabBar,
                                   NSLayoutAttribute.Top,
                                   NSLayoutRelation.Equal,
                                   View,
                                   NSLayoutAttribute.Top,
                                   1, 0
                                   ));

            View.AddConstraint(NSLayoutConstraint.Create(
                                   pageViewController.View,
                                   NSLayoutAttribute.Top,
                                   NSLayoutRelation.Equal,
                                   TabBar,
                                   NSLayoutAttribute.Bottom,
                                   1, 0
                                   ));

            tabBarHeight = NSLayoutConstraint.Create(
                TabBar,
                NSLayoutAttribute.Height,
                NSLayoutRelation.Equal,
                1, 68
                );
            TabBar.AddConstraint(tabBarHeight);

            pageViewController.SetViewControllers(
                new[] { ViewControllers[0] },
                UIPageViewControllerNavigationDirection.Forward,
                true, null
                );
            pageViewController.WeakDataSource      = this;
            pageViewController.DidFinishAnimating += HandlePageViewControllerDidFinishAnimating;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //table.Layer.MasksToBounds = false;
            //table.Layer.ShadowRadius = 10.0f;
            //table.Layer.ShadowColor = Color.Black.ToCGColor();
            //table.Layer.ShadowOffset = new CGSize(0.0f, 4.0f);
            //table.Layer.ShadowOpacity = 0.25f;
            //table.Layer.BorderColor = UIColor.LightGray.CGColor;
            //table.Layer.BorderWidth = 0.1f;
            TabBar.Layer.MasksToBounds = false;
            TabBar.Layer.ShadowRadius  = 5f;
            TabBar.Layer.ShadowOffset  = new CGSize(0.0f, 4.0f);
            TabBar.Layer.ShadowOpacity = 0.25f;
            TabBar.Layer.BorderColor   = Color.LightGray.ToCGColor();
            TabBar.Layer.BorderWidth   = 1f;

            TabBar.TabSelected += TabBar_TabSelected;
            View.AddSubview(TabBar);

            AddChildViewController(pageViewController);
            View.AddSubview(pageViewController.View);
            pageViewController.View.TranslatesAutoresizingMaskIntoConstraints = false;
            pageViewController.DidMoveToParentViewController(this);


            var views = NSDictionary.FromObjectsAndKeys(
                new NSObject[] {
                TabBar,
                pageViewController.View
            },
                new NSObject[] {
                (NSString)"tabbar",
                (NSString)"content"
            }
                );

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[tabbar]-0-|",
                                                                    0,
                                                                    null,
                                                                    views));
            //View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[tabbar]-0-|",
            //                                                        0,
            //                                                        null,
            //                                                        views));
            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|-0-[content]-0-|",
                                                                    0,
                                                                    null,
                                                                    views));

            View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|-0-[tabbar]-0-[content]-0-|",
                                                                    0,
                                                                    null,
                                                                    views));

            tabBarWidth = NSLayoutConstraint.Create(
                TabBar,
                NSLayoutAttribute.Width,
                NSLayoutRelation.Equal,
                1, 64
                );
            TabBar.AddConstraint(tabBarWidth);
            //TabBar.BackgroundColor = UIColor.Red;

            if (pageViewController.ViewControllers.Length == 0 &&
                lastSelectedIndex >= 0 && lastSelectedIndex < ViewControllers.Count)
            {
                pageViewController.SetViewControllers(
                    new[] { ViewControllers[lastSelectedIndex] },
                    UIPageViewControllerNavigationDirection.Forward,
                    true, null
                    );
            }

            // UpdateSwipe(Tabbed.SwipeEnabled);
            pageViewController.DidFinishAnimating += HandlePageViewControllerDidFinishAnimating;
        }