弹出导航控制器菜单指示器

时间:2014-03-09 00:30:24

标签: ios xamarin.ios

我在Xamarin IOS应用程序中使用Flyout导航组件,我可以将多个视图控制器连接到它,并且向左滑动并能够看到菜单项。但我没有像抽屉菜单应用程序(如Facebook和许多Android应用程序)那样在顶部获得菜单指示器。这是我使用的代码

    FlyoutNavigationController navController = new FlyoutNavigationController {//this will create a new instance of the FlyoutComponent
            NavigationRoot = new RootElement("Menu"){ //Here we create the root of the alements
                new Section("Seccion 1"){
                    new StringElement("Picks"),
                    new StringElement("Watchlist"),
                },
                new Section("Seccion 2"){
                    new StringElement("Portfolio"),
                },
            },
            ViewControllers =  new [] {//here we link Controllers
                this.Storyboard.InstantiateViewController("Picks") as UIViewController,//here we create the instances for the Controllers
                this.Storyboard.InstantiateViewController("Watchlist") as UIViewController,
                this.Storyboard.InstantiateViewController("Portfolio") as UIViewController,
            }
        };
//navController.ToggleMenu();
        View.AddSubview (navController.View);

1 个答案:

答案 0 :(得分:2)

最后我发现我必须设置左侧栏按钮项目,其图像看起来像这样的抽屉菜单

UIBarButtonItem menuIndicator = new UIBarButtonItem (UIImage.FromBundle   ("images/slideout.png"), UIBarButtonItemStyle.Plain, (sender, e) => {
            AppDelegate.FlyoutNavigation.ToggleMenu ();
        });
        NavigationItem.SetLeftBarButtonItem (menuIndicator, false);