I am using the Flyout navigation component in my Xamarin IOS application and I am able to connect multiple view controllers to it and also swipe out left and able to see the menu items. But I am not getting a menu indicator at the top as like in the drawer menu applications(like facebook and many android apps). Here is the code I used
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);
Finally I figured out that I have to set the left bar button item with an image looking like a drawer menu like this
UIBarButtonItem menuIndicator = new UIBarButtonItem (UIImage.FromBundle ("images/slideout.png"), UIBarButtonItemStyle.Plain, (sender, e) => {
AppDelegate.FlyoutNavigation.ToggleMenu ();
});
NavigationItem.SetLeftBarButtonItem (menuIndicator, false);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments