[go: up one dir, main page]

DEV Community

Logesh Palani
Logesh Palani

Posted on • Originally published at logeshpalani.blogspot.com on

SideMenu in Xamarin iOS

Introduction

This blog demonstrates how to use a sidemenu or navigation drawer in Xamarin iOS. since there is no default future for the sidemenu or navigation drawer view. We can archive this view using _Xamarin.Sidemenu _NuGet with putting a lot of effort.

Let's start

Create a new Xamarin iOS Single View Application in Visual Studio for Mac.

After the project creation, install Xamarin.Sidemenu Nuget package by going to Solution Explorer >> right-click and select Manage NuGet Package and search Xamarin.Sidemenu and select install the plugin.

Now, open your Main.Storyboard and design two scenes for the right and left navigation drawer as per your required design and one more ViewController for the Main or Root ViewController. Here, I don't want any more design, just gave background color for these scenes and Create two ViewController classes for these scenes and this controller should be inherited from UIViewController.

Next, open your View Controller and create SideMenuManager instance and configure right and left side ViewController. Here, I created the ViewController instance and configure these ViewController with SideMenuManager. Now, we can add gestures for these sidemenu controllers. Here, I wrote PanGesture and EdgePanGesture _and added these gestures to the direct added into _NavigationController, incase you want to add for a specific scene you can. Next, we can set this instance to the toolbar left and right button. By default, the left, and right drawer ViewController scene Navigation bar TitleView is enabled. if you want to disable the NavigationBar title view. First, create an instance for that ViewController _and set false for _NavigationBarHidden property true. Some cool effects based properties are available for use as a blur, background image. These effects code is given in the SetDefault method. Yah! we have one more useful and lovely effect is available, which is the Sidemenu Navigation Animation type and Its types are Slide In, Slide Out, Dissolve, SlideInOut.

Now, run your application, you will get output like below.

Source code in Github

Summary

  • Install Xamarin.SideMenu plugin
  • Configure the left and right view controller scene to SideMenu Manager
  • Add Gestures

Thanks for reading !!!

Top comments (0)