Ejemplo n.º 1
0
        void SelectListWithListInfo(ListInfo listInfo)
        {
            UISplitViewController splitViewController = SplitViewController;

            Action <ListViewController> ConfigureListViewController = listViewController => {
                listViewController.ConfigureWith(listInfo);
                listViewController.MasterController = this;
            };

            if (splitViewController.Collapsed)
            {
                ListViewController listViewController = (ListViewController)Storyboard.InstantiateViewController("listViewController");
                ConfigureListViewController(listViewController);
                ShowViewController(listViewController, this);
            }
            else
            {
                UINavigationController navigationController = (UINavigationController)Storyboard.InstantiateViewController("listViewNavigationController");
                ListViewController     listViewController   = (ListViewController)navigationController.TopViewController;
                ConfigureListViewController(listViewController);
                SplitViewController.ViewControllers = new UIViewController[] {
                    SplitViewController.ViewControllers [0],
                    new UIViewController()
                };
                ShowDetailViewController(navigationController, this);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Displays the content UISplitViewController.
 /// </summary>
 /// <param name="content">The content.</param>
 public void DisplayContentController(UISplitViewController content)
 {
     AddChildViewController(content);
     content.View.Frame = View.Frame;
     View.AddSubview(content.View);
     DidMoveToParentViewController(this);
 }
Ejemplo n.º 3
0
 public override bool ShouldHideViewController(UISplitViewController svc, UIViewController viewController, UIInterfaceOrientation inOrientation)
 {
     //return true; // always hide
     //return true; // never hide
     return inOrientation == UIInterfaceOrientation.Portrait
         || inOrientation == UIInterfaceOrientation.PortraitUpsideDown;
 }
		//
		// This method is invoked when the application has loaded and is ready to run. In this 
		// method you should instantiate the window, load the UI into it and then make the window
		// visible.
		//
		// You have 17 seconds to return from this method, or iOS will terminate your application.
		//
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			// create a new window instance based on the screen size
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			
			// load the appropriate UI, depending on whether the app is running on an iPhone or iPad
			if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
				var controller = new RootViewController ();
				navigationController = new UINavigationController (controller);
				window.RootViewController = navigationController;
			} else {
				var masterViewController = new RootViewController ();
				var masterNavigationController = new UINavigationController (masterViewController);
				var detailViewController = new DetailViewController ();
				var detailNavigationController = new UINavigationController (detailViewController);
				
				splitViewController = new UISplitViewController ();
				splitViewController.WeakDelegate = detailViewController;
				splitViewController.ViewControllers = new UIViewController[] {
					masterNavigationController,
					detailNavigationController
				};
				
				window.RootViewController = splitViewController;
			}

			// make the window visible
			window.MakeKeyAndVisible ();
			
			return true;
		}
		protected override void SetRootViewController ()
		{
			if (IsPhone) {

				window.RootViewController = docListNav;

			} else {

				var blankVC = new BlankVC ();
				blankVC.View.BackgroundColor = UIColor.White;

				detailNav = new UINavigationController (blankVC);
				detailNav.NavigationBar.BarStyle = Theme.NavigationBarStyle;
				detailNav.ToolbarHidden = false;
				Theme.Apply (detailNav.Toolbar);

				split = new UISplitViewController {
					PresentsWithGesture = false,
					ViewControllers = new UIViewController[] {
						docListNav,
						detailNav,
					},
					Delegate = new SplitDelegate (),
				};

				window.RootViewController = split;
			}
		}
Ejemplo n.º 6
0
        public void Init(UIViewController vc)
        {
            _masterNavigationController = new UINavigationController(vc);

            if (_navStyle == MXTouchNavigationStyle.SplitViewOnPad && UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                // toss a generic view in the detail pane
                _detailNavigationController = new UINavigationController(new SplashViewController(_initialViewImage));

                _splitViewController = new SplitViewController();
                _splitViewControllerDelegate = new SplitViewControllerDelegate();
                _splitViewController.Delegate = _splitViewControllerDelegate;
                _splitViewController.ViewControllers = new UIViewController[2] { _masterNavigationController, _detailNavigationController };

                this.View = _splitViewController.View;
            }
             	else if (vc is UITabBarController)
            {
                _tabBarController = (vc as UITabBarController);
                this.View = vc.View;
            }
            else
            {
                // we are an iPhone, skip the split view and use the navigation controller instead!
                this.View = _masterNavigationController.View;
            }
        }
        public override void ViewDidLoad ()
		{
            if (!this.propertiesAssigned)
            {
                return;
            }

			base.ViewDidLoad ();
			
			// speakers tab
			if (AppDelegate.IsPhone) {
                this.speakersScreen = this.ObjectFactory.Create<PatientListViewController>(new NamedParameterOverloads { { "patientSplitViewController", null } });
				this.speakerNav = this.ObjectFactory.Create<UINavigationController>();
				this.speakerNav.TabBarItem = new UITabBarItem("Patients"
											, UIImage.FromBundle("Images/Tabs/speakers.png"), 1);
				this.speakerNav.PushViewController ( this.speakersScreen, false );
			} else {
                this.speakersSplitView = this.ObjectFactory.Create<PatientSplitViewController>();
				this.speakersSplitView.TabBarItem = new UITabBarItem("Patients"
											, UIImage.FromBundle("Images/Tabs/speakers.png"), 1);
			}

			
			// about tab
			this.aboutScreen = new AboutView();
			this.aboutScreen.TabBarItem = new UITabBarItem("About Xamarin"
										, UIImage.FromBundle("Images/Tabs/about.png"), 8);
			
			UIViewController[] viewControllers;
			// create our array of controllers
			if (AppDelegate.IsPhone) {
				viewControllers = new UIViewController[] {
					this.speakerNav,
					this.aboutScreen
				};
			} else {	// IsPad
				viewControllers = new UIViewController[] {
					this.speakersSplitView,
					this.aboutScreen
				};
			}
			
			// attach the view controllers
			this.ViewControllers = viewControllers;
			
			// tell the tab bar which controllers are allowed to customize. 
			// if we don't set  it assumes all controllers are customizable. 
			// if we set to empty array, NO controllers are customizable.
			this.CustomizableViewControllers = new UIViewController[] {};
			
			// set our selected item
		    if (AppDelegate.IsPhone)
		    {
                this.SelectedViewController = this.speakerNav;
		    }
		    else
		    {
		        this.SelectedViewController = this.speakersSplitView;
		    }
		}
        public void Init(UIViewController vc)
        {
            _masterNavigationController = new UINavigationController(vc);

            if (_navStyle == MXTouchNavigationStyle.SplitViewOnPad && UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
            {
                // toss a generic view in the detail pane
                _detailNavigationController = new UINavigationController(new SplashViewController(_initialViewImage));

                _splitViewController                 = new SplitViewController();
                _splitViewControllerDelegate         = new SplitViewControllerDelegate();
                _splitViewController.Delegate        = _splitViewControllerDelegate;
                _splitViewController.ViewControllers = new UIViewController[2] {
                    _masterNavigationController, _detailNavigationController
                };

                this.View = _splitViewController.View;
            }
            else if (vc is UITabBarController)
            {
                _tabBarController = (vc as UITabBarController);
                this.View         = vc.View;
            }
            else
            {
                // we are an iPhone, skip the split view and use the navigation controller instead!
                this.View = _masterNavigationController.View;
            }
        }
Ejemplo n.º 9
0
        protected override void Initialize()
        {
            base.Initialize();

            /*if (UseMGSplitViewController) {
             *      MGSplitController = new MG.MGSplitViewController ();
             *      Control = MGSplitController.View;
             * } else*/{
                SplitController          = new UISplitViewController();
                SplitController.Delegate = new SplitControllerDelegate();
                Control = SplitController.View;
            }
            //SplitController.Delegate = new MG.MGSplitViewControllerDelegate();
            Control.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            children     = new UIViewController[2];
            children [0] = new UIViewController();
            children [1] = new UIViewController();
            SetViewControllers();

            /*if (UseMGSplitViewController) {
             *      MGSplitController.AllowsDraggingDivider = true;
             *      MGSplitController.DividerStyle = MG.MGSplitViewDividerStyle.PaneSplitter;
             *      MGSplitController.SplitWidth = 10;
             * }*/
        }
        public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            _pc = null;
            _lefty = null;

            ReplaceDetailNavigationViewController();
        }
 /// <summary>
 /// Displays the content UISplitViewController.
 /// </summary>
 /// <param name="content">The content.</param>
 public void DisplayContentController(UISplitViewController content)
 {
     AddChildViewController(content);
     content.View.Frame = View.Frame;
     View.AddSubview(content.View);
     DidMoveToParentViewController(this);
 }
Ejemplo n.º 12
0
 public override void WillPresentViewController(UISplitViewController svc, UIPopoverController pc, UIViewController aViewController)
 {
     if (Parent.BarButtonItemPopover.PopoverVisible)
     {
         Parent.BarButtonItemPopover.Dismiss(true);
     }
 }
Ejemplo n.º 13
0
            public override bool CollapseSecondViewController(UISplitViewController splitViewController,
                                                              UIViewController secondaryViewController, UIViewController primaryViewController)
            {
                Photo photo = ((CustomViewController)secondaryViewController).ContainedPhoto(null);

                if (photo == null)
                {
                    return(true);
                }

                if (primaryViewController.GetType() == typeof(CustomNavigationController))
                {
                    var viewControllers = new List <UIViewController> ();
                    foreach (var controller in ((UINavigationController)primaryViewController).ViewControllers)
                    {
                        var        type   = controller.GetType();
                        MethodInfo method = type.GetMethod("ContainsPhoto");

                        if ((bool)method.Invoke(controller, new object[] { null }))
                        {
                            viewControllers.Add(controller);
                        }
                    }

                    ((UINavigationController)primaryViewController).ViewControllers = viewControllers.ToArray <UIViewController> ();
                }

                return(false);
            }
Ejemplo n.º 14
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            var masterViewController = new RootViewController ();
            var masterNavigationController = new UINavigationController (masterViewController);
            var detailViewController = new DetailViewController ();
            var detailNavigationController = new UINavigationController (detailViewController);

            masterViewController.DetailViewController = detailViewController;

            splitViewController = new UISplitViewController ();
            splitViewController.WeakDelegate = detailViewController;
            splitViewController.ViewControllers = new UIViewController[] {
                masterNavigationController,
                detailNavigationController
            };

            window.RootViewController = splitViewController;

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
 public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
 {
     _svc = svc as SplitViewController;
     _lefty = barButtonItem;
     _lefty.Title = "Home";
     _pc = pc;
     ReplaceDetailNavigationViewController();
 }
Ejemplo n.º 16
0
            public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
            {
                var items = new List <UIBarButtonItem> (Parent.Toolbar.Items);

                items.RemoveAt(0);
                Parent.Toolbar.SetItems(items.ToArray(), true);
                Parent.MainPopoverController = null;
            }
Ejemplo n.º 17
0
 public UIViewController SeparateSecondaryViewController(UISplitViewController splitViewController, UIViewController primaryViewController)
 {
     if (primaryViewController is UINavigationController nav && nav.TopViewController is SettingsController settings)
     {
         return(Utils.CreateEmptyViewController());
     }
     return(null);
 }
Ejemplo n.º 18
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            UISplitViewController splitViewController = (UISplitViewController)Window.RootViewController;

            splitViewController.PreferredDisplayMode = UISplitViewControllerDisplayMode.AllVisible;

            return(true);
        }
Ejemplo n.º 19
0
        public void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            var tmp   = Toolbar.Items;
            var items = tmp != null?tmp.ToList() : new List <UIBarButtonItem> ();

            items.Remove(button);
            Toolbar.SetItems(items.ToArray(), true);
        }
			public override void WillHideViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
			{
				barButtonItem.Title =  "MasterList";
				var items = new List<UIBarButtonItem> (Parent.Toolbar.Items);
				items.Insert (0, barButtonItem);
				Parent.Toolbar.SetItems (items.ToArray (), true);
				Parent.MainPopoverController = pc;
			}
			public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
			{
				var items = new List<UIBarButtonItem> (Parent.Toolbar.Items);
				items.RemoveAt (0);
				Parent.Toolbar.SetItems (items.ToArray (), true);
				Parent.MainPopoverController = null;
				
			}
Ejemplo n.º 22
0
            public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
            {
                var dv    = svc.ViewControllers [1] as DetailViewController;
                var items = new List <UIBarButtonItem> (dv.toolbar.Items);

                items.RemoveAt(0);
                dv.toolbar.SetItems(items.ToArray(), true);
                dv.popoverController = null;
            }
Ejemplo n.º 23
0
		public override void WillHideViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
		{
			SessionSpeakersMasterDetail dvc = svc.ViewControllers[1] as SessionSpeakersMasterDetail;
			
			if (dvc != null) {
				dvc.AddNavBarButton (barButtonItem);
				dvc.Popover = pc;
			} else Console.WriteLine ("SessionSplitViewController dvc == null (hide)");
		}
		public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
		{
			PatientDetailViewController dvc = svc.ViewControllers[1] as PatientDetailViewController;
			
			if (dvc != null) {
				dvc.RemoveNavBarButton ();
				dvc.Popover = null;
			}
		}
		public override void WillHideViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
		{
			PatientDetailViewController dvc = svc.ViewControllers[1] as PatientDetailViewController;
			
			if (dvc != null) {
				dvc.AddNavBarButton (barButtonItem);
				dvc.Popover = pc;
			}
		}
Ejemplo n.º 26
0
		public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
		{
			SessionSpeakersMasterDetail dvc = svc.ViewControllers[1] as SessionSpeakersMasterDetail;
			
			if (dvc != null) {
				dvc.RemoveNavBarButton ();
				dvc.Popover = null;
			} else ConsoleD.WriteLine ("SessionSplitViewController dvc == null (show)");
		}
Ejemplo n.º 27
0
		public override void WillHideViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
		{
			SessionSpeakersMasterDetail dvc = svc.ViewControllers[1] as SessionSpeakersMasterDetail;
			
			if (dvc != null) {
				dvc.AddNavBarButton (barButtonItem);
				dvc.Popover = pc;
			} else ConsoleD.WriteLine ("SessionSplitViewController dvc == null (hide)");
		}
            public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
            {
                var items = _controller.toolbar.Items.ToList();

                items.Insert(0, barButtonItem);

                _controller.toolbar.SetItems(items.ToArray(), true);
                _controller.Popover = pc;
            }
            public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
            {
                var items = _controller.toolbar.Items.ToList();

                items.RemoveAt(0);

                _controller.toolbar.SetItems(items.ToArray(), false);
                _controller.Popover = null;
            }
Ejemplo n.º 30
0
 public override bool ShouldHideViewController(
     UISplitViewController svc,
     UIViewController viewController,
     UIInterfaceOrientation inOrientation)
 {
     return((!InAppPurchaseModel.Editor.Purchased) ||
            inOrientation == UIInterfaceOrientation.Portrait ||
            inOrientation == UIInterfaceOrientation.PortraitUpsideDown);
 }
Ejemplo n.º 31
0
        void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
        {
            barButtonItem.Title = "Master";
            var bItems = NavigationItem.RightBarButtonItems;
            var items  = bItems != null?bItems.ToList() : new List <UIBarButtonItem> ();

            items.Insert(0, barButtonItem);
            Toolbar.SetItems(items.ToArray(), true);
        }
Ejemplo n.º 32
0
		public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
		{
			var tabBarViewController = (UITabBarController)svc.ViewControllers[1];			
			var detailsNavController = (UINavigationController)tabBarViewController.SelectedViewController;

			detailsNavController.ViewControllers[0].NavigationItem.SetLeftBarButtonItem (null, true);

			controller.Popover = null;
		}
Ejemplo n.º 33
0
            public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
            {
                barButtonItem.Title = "MasterList";
                var items = new List <UIBarButtonItem> (Parent.Toolbar.Items);

                items.Insert(0, barButtonItem);
                Parent.Toolbar.SetItems(items.ToArray(), true);
                Parent.MainPopoverController = pc;
            }
Ejemplo n.º 34
0
		public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
		{
			SpeakerSessionMasterDetail dvc = svc.ViewControllers[1] as SpeakerSessionMasterDetail;
			
			if (dvc != null) {
				dvc.RemoveNavBarButton ();
				dvc.Popover = null;
			}
		}
Ejemplo n.º 35
0
		public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
		{
			SessionSpeakersMasterDetail dvc = svc.ViewControllers[1] as SessionSpeakersMasterDetail;
			
			if (dvc != null) {
				dvc.RemoveNavBarButton ();
				dvc.Popover = null;
			} else Console.WriteLine ("SessionSplitViewController dvc == null (show)");
		}
Ejemplo n.º 36
0
        void SplitViewControllerWillShow(UISplitViewController splitController, UIViewController viewController,
                                         UIBarButtonItem barButtonItem)
        {
            var items = navigationItem.LeftBarButtonItems.ToList();

            items.Remove(barButtonItem);

            navigationItem.LeftBarButtonItems = items.ToArray();
        }
Ejemplo n.º 37
0
		public override void WillHideViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
		{
			SpeakerSessionMasterDetail dvc = svc.ViewControllers[1] as SpeakerSessionMasterDetail;
			
			if (dvc != null) {
				dvc.AddNavBarButton (barButtonItem);
				dvc.Popover = pc;
			}
		}
Ejemplo n.º 38
0
        public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            SpeakerSessionMasterDetail dvc = svc.ViewControllers[1] as SpeakerSessionMasterDetail;

            if (dvc != null)
            {
                dvc.RemoveNavBarButton();
                dvc.Popover = null;
            }
        }
Ejemplo n.º 39
0
        public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
        {
            SpeakerSessionMasterDetail dvc = svc.ViewControllers[1] as SpeakerSessionMasterDetail;

            if (dvc != null)
            {
                dvc.AddNavBarButton(barButtonItem);
                dvc.Popover = pc;
            }
        }
Ejemplo n.º 40
0
            public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
            {
                var dvc = svc as SplitViewController;

                if (dvc != null)
                {
                    dvc.AddNavigationButton(barButtonItem);
                    dvc.SetPopover(pc);
                }
            }
Ejemplo n.º 41
0
            public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
            {
                var dvc = svc as SplitViewController;

                if (dvc != null)
                {
                    dvc.RemoveNavigationButton();
                    dvc.RemovePopover();
                }
            }
 public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
 {
     try {
         Popover = null;
         var detailNav = (UINavigationController)svc.ViewControllers [1];
         detailNav.TopViewController.NavigationItem.LeftBarButtonItem = null;
     } catch (Exception ex) {
         Log.Error(ex);
     }
 }
        public override void WillHideViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
        {
            PatientDetailViewController dvc = svc.ViewControllers[1] as PatientDetailViewController;

            if (dvc != null)
            {
                dvc.AddNavBarButton(barButtonItem);
                dvc.Popover = pc;
            }
        }
        public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            PatientDetailViewController dvc = svc.ViewControllers[1] as PatientDetailViewController;

            if (dvc != null)
            {
                dvc.RemoveNavBarButton();
                dvc.Popover = null;
            }
        }
Ejemplo n.º 45
0
		public virtual bool CollapseSecondViewController (UISplitViewController splitViewController, UIViewController secondaryViewController, UIViewController primaryViewController)
		{
			var secondaryAsNavController = secondaryViewController as UINavigationController;

			if (secondaryAsNavController == null)
				return false;

			var topAsDetailController = secondaryAsNavController.TopViewController as DetailViewController;
			return topAsDetailController != null && string.IsNullOrEmpty (topAsDetailController.DetailItemTitle);
		}
Ejemplo n.º 46
0
        public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            var detailViewController = svc.ViewControllers[1] as ISubstitutableDetailViewController;

            detailViewController.InvalidateRootPopoverButtonItem(detailViewController.RootPopoverButtonItem);

            detailViewController.PopOverController = null;

            detailViewController.RootPopoverButtonItem = null;
        }
Ejemplo n.º 47
0
        public SplitterHandler()
        {
            SplitController = new RotatableSplitViewController();
            Control         = Controller.View;

            children    = new UIViewController[2];
            children[0] = new UIViewController();
            children[1] = new UIViewController();
            SplitController.ViewControllers = children;
        }
Ejemplo n.º 48
0
        public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            var detailViewController = svc.ViewControllers[1] as ISubstitutableDetailViewController;

              detailViewController.InvalidateRootPopoverButtonItem(detailViewController.RootPopoverButtonItem);

              detailViewController.PopOverController = null;

              detailViewController.RootPopoverButtonItem = null;
        }
Ejemplo n.º 49
0
 public bool CollapseSecondViewController (UISplitViewController splitViewController, UIViewController secondaryViewController, UIViewController primaryViewController)
 {
     if (secondaryViewController.GetType () == typeof (UINavigationController) &&
         ((UINavigationController)secondaryViewController).TopViewController.GetType () == typeof (DetailViewController) &&
         ((DetailViewController)((UINavigationController)secondaryViewController).TopViewController).DetailItem == null) {
         // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
         return true;
     }
     return false;
 }
Ejemplo n.º 50
0
		public override void WillHideViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
		{
			barButtonItem.Title = "Workouts";
			var tabBarViewController = (UITabBarController)svc.ViewControllers[1];			
			var detailsNavController = (UINavigationController)tabBarViewController.SelectedViewController;

			detailsNavController.ViewControllers[0].NavigationItem.SetLeftBarButtonItem (barButtonItem, true);

			controller.Popover = pc;
		}
Ejemplo n.º 51
0
        public void willHideViewController(UISplitViewController svc, UIViewController vc, UIBarButtonItem bbi, UIPopoverController poc)
        {
            // If this bar button item doesn't have a title, it won't appear at all.
            bbi.Title = "List";

            // Take this bar button item and put it on the left side of our nav item
            this.NavigationItem.SetLeftBarButtonItem(bbi, true);

            popover = poc;
        }
Ejemplo n.º 52
0
 public bool CollapseSecondViewController(UISplitViewController splitViewController, UIViewController secondaryViewController, UIViewController primaryViewController)
 {
     if (secondaryViewController.GetType () == typeof(UINavigationController) &&
         ((UINavigationController)secondaryViewController).TopViewController.GetType () == typeof(DetailViewController) &&
         ((DetailViewController)((UINavigationController)secondaryViewController).TopViewController).DetailItem == null) {
         // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
         return true;
     }
     return false;
 }
Ejemplo n.º 53
0
		public bool CollapseSecondViewController (UISplitViewController splitViewController, UIViewController secondaryViewController, UIViewController primaryViewController)
		{
			var secondaryAsNavController = secondaryViewController as UINavigationController;
			if (secondaryAsNavController == null)
				return false;

			var topAsDetailController = secondaryAsNavController.TopViewController as AssetGridViewController;
			if (topAsDetailController == null)
				return false;

			// Return true to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded.
			return topAsDetailController.FetchResult == null;
		}
		public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
		{
			//Console.WriteLine("SplitDelegate.WillShowViewController");
			var detailViewController = svc.ViewControllers [1] as ISubstitutableDetailViewController;
			
			//Console.WriteLine("SplitDelegate.WillShowViewController - detailViewController.RootPopoverButtonItem is null " +  (detailViewController.RootPopoverButtonItem == null).ToString());
			detailViewController.InvalidateRootPopoverButtonItem (detailViewController.RootPopoverButtonItem);
			
			//Console.WriteLine("SplitDelegate.WillShowViewController - setting detailViewController.PopOverController = null");
			detailViewController.PopOverController = null;

			//Console.WriteLine("SplitDelegate.WillShowViewController - setting detailViewController.RootPopoverButtonItem = null");
			detailViewController.RootPopoverButtonItem = null;
		}
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // Create the main window and add the navigation controller as a subview
            App_Window = new UIWindow (UIScreen.MainScreen.Bounds);

            SV_Controller = new MySplitViewController();
            SV_Controller.Delegate = new UISplitViewControllerDelegate();
            SV_Controller.ViewControllers = new UIViewController[] { new MyNavigationController(), new DetailViewController("Hello World") };
            App_Window.RootViewController = SV_Controller;

            App_Window.MakeKeyAndVisible();

            return true;
        }
Ejemplo n.º 56
0
		public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
		{
			// Override point for customization after application launch.
			// If not required for your application you can safely delete this method
			Window =new UIWindow();
			MasterView master = new MasterView ();
			DetailView detail = new DetailView ();
			UISplitViewController splitView = new UISplitViewController ();
			splitView.ViewControllers = new UIViewController[]{ master,detail};
			splitView.Delegate = new SplitControllerDelegate (detail);
			Window.RootViewController = splitView;
			Window.MakeKeyAndVisible ();
			return true;
		}
Ejemplo n.º 57
0
        public override void WillHideViewController(UISplitViewController svc, 
                                                 UIViewController aViewController, 
                                                 UIBarButtonItem barButtonItem, 
                                                 UIPopoverController pc)
        {
            barButtonItem.Title = "Root View Controller";

              var detailViewController = svc.ViewControllers[1] as ISubstitutableDetailViewController;

              detailViewController.PopOverController = pc;

              detailViewController.RootPopoverButtonItem = barButtonItem;

              detailViewController.ShowRootPopoverButtonItem(detailViewController.RootPopoverButtonItem);
        }
Ejemplo n.º 58
0
			public override UIViewController SeparateSecondaryViewController (UISplitViewController splitViewController,
																			  UIViewController primaryViewController)
			{
				if (primaryViewController.GetType () == typeof(CustomNavigationController)) {
					foreach (var controller in ((CustomNavigationController)primaryViewController).ViewControllers) {
						var type = controller.GetType ();
						MethodInfo method = type.GetMethod ("ContainedPhoto");

						if (method.Invoke (controller, new object[] { null }) != null) {
							return null;
						}
					}
				}

				return new EmptyViewController ();
			}
Ejemplo n.º 59
0
		public bool CollapseSecondViewController (UISplitViewController splitViewController, UIViewController secondaryViewController, UIViewController primaryViewController)
		{
			splitViewController.PreferredDisplayMode = UISplitViewControllerDisplayMode.Automatic;

			// If there's a list that's currently selected in separated mode and we want to show it in collapsed mode, we'll transfer over the view controller's settings.
			var secondaryNavigationController = secondaryViewController as UINavigationController;
			if (secondaryNavigationController != null) {
				UIStringAttributes textAttributes = secondaryNavigationController.NavigationBar.TitleTextAttributes;
				PrimaryViewController.NavigationBar.TitleTextAttributes = textAttributes;
				PrimaryViewController.NavigationBar.TintColor = secondaryNavigationController.NavigationBar.TintColor;
				PrimaryViewController.Toolbar.TintColor = secondaryNavigationController.Toolbar.TintColor;

				PrimaryViewController.ShowDetailViewController (secondaryNavigationController.TopViewController, null);
			}

			return true;
		}
Ejemplo n.º 60
0
		public bool EventShowDetailViewController (UISplitViewController splitViewController, UIViewController vc, NSObject sender)
		{
			// Let the storyboard handle the segue for every case except going from detail:assetgrid to detail:asset.
			if (splitViewController.Collapsed)
				return false;

			if (vc is UINavigationController)
				return false;

			var detailNavController = splitViewController.ViewControllers.Last () as UINavigationController;
			if (detailNavController == null || detailNavController.ViewControllers.Length == 1)
				return false;

			detailNavController.PushViewController (vc, true);

			return true;
		}