Xamarin.iOS侧滑菜单控件——SlideoutNavigation

iOS侧滑菜单已然不是什么新鲜事,但想在xamarin实现却不是件简单的事,今天分享一下在项目中使用到的第三方的开源控件SlideoutNavigation,SlideoutNavigation的使用相当简单,只需在FinishedLaunching中简单配置一下侧边栏菜单及主菜单方可使用,兼容iOS6、7:

1.源码地址(github):SlideoutNavigation

2.使用方法:

public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
            window = new UIWindow (UIScreen.MainScreen.Bounds);
            Menu = new SlideoutNavigationController ();
			Menu.SlideHeight = 9999f;
            Menu.TopView = new HomeViewController ();
            Menu.MenuViewLeft = new DummyControllerLeft ();
			Menu.MenuViewRight = new DummyControllerRight ();

            window.RootViewController = Menu;
            window.MakeKeyAndVisible ();

            return true;
}

3.部分可设属性

1)左右按钮显示           

Menu.DisplayNavigationBarOnRightMenu = false;
Menu.DisplayNavigationBarOnLeftMenu = false;

 

 

2)设置导航条菜单图标

		/// <summary>
		/// Creates the menu button for the left side.
		/// </summary>
		protected virtual UIBarButtonItem CreateLeftMenuButton ()
		{
			//你需要自定义按钮图标
			UIImage imgMenu = ViewStyle.GetModelImage (ModelImageEnum.Common, "btn_menu.png");
			UIButton menuBtn = new UIButton (UIButtonType.Custom);
			menuBtn.Frame = new RectangleF (0, 0, imgMenu.Size.Width, imgMenu.Size.Height);	
			menuBtn.SetBackgroundImage (imgMenu, UIControlState.Normal);
			menuBtn.TouchUpInside += delegate {
				ShowMenuLeft ();
			} ;
			return new UIBarButtonItem (menuBtn);
		}


4.效果图:

    

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值