public override void ViewDidAppear(bool animated) { base.ViewWillAppear(animated); UINavigationController nav = NavigationController; MainViewController controller = (MainViewController)nav.ParentViewController; // MainViewController : ZUUIRevealController // Check if a UIPanGestureRecognizer already sits atop our NavigationBar. if (nav.NavigationBar.GestureRecognizers == null || !(nav.NavigationBar.GestureRecognizers.Contains(navigationBarPanGestureRecognizer))) { // If not, allocate one and add it. UIPanGestureRecognizer panGestureRecognizer = new UIPanGestureRecognizer(controller.RevealGesture); navigationBarPanGestureRecognizer = panGestureRecognizer; NavigationController.NavigationBar.AddGestureRecognizer(navigationBarPanGestureRecognizer); } // Check if we have a revealButton already. if (NavigationItem.LeftBarButtonItem == null) { // If not, allocate one and add it. UIImage imageMenu = UIImage.FromFile("action_menu.png"); UIButton menuButton = new UIButton(UIButtonType.Custom); menuButton.SetImage(imageMenu, UIControlState.Normal); menuButton.Frame = new RectangleF(0.0f, 0.0f, (float)imageMenu.Size.Width, (float)imageMenu.Size.Height); menuButton.TouchUpInside += (sender, e) => controller.RevealToggle(); NavigationItem.LeftBarButtonItem = new UIBarButtonItem(menuButton); } }
void TableViewDidSelectRowAtIndexPath(UITableView aTableView, NSIndexPath indexPath) { if (indexPath.Section == 0) { return; } searchBar.ResignFirstResponder(); MainViewController mainController = (MainViewController)ParentViewController; // Either change the view displayed as a Master View if (indexPath.Row == 0) { if ((mainController.ContentViewController is UINavigationController) && !(((UINavigationController)mainController.ContentViewController).TopViewController is MasterViewController)) { MasterViewController frontVC = (MasterViewController)Storyboard.InstantiateViewController("FrontVC"); UINavigationController nav = new UINavigationController(frontVC); mainController.ContentViewController = nav; } mainController.ToggleSidebar(!mainController.SidebarShowing); } else { if ((mainController.ContentViewController is UINavigationController) && !(((UINavigationController)mainController.ContentViewController).TopViewController is SecondViewController)) { SecondViewController secondVC = (SecondViewController)Storyboard.InstantiateViewController("SecondVC"); UINavigationController nav = new UINavigationController(secondVC); mainController.ContentViewController = nav; } mainController.ToggleSidebar(!mainController.SidebarShowing); } }