可自定义的边栏菜单ios源码
这个源码是可自定义的边栏菜单,源码MDMenuViewController,MDMenuViewController提供使用的边栏菜单。菜单项可自定义,由数组组成。菜单上的文字图片等完全支持自定义,菜单还支持横屏。 效果图:
使用方法: 将整个"MDMenuViewController classes"文件夹加入到自己的项目中: 构件各个页面,继承Child类: @interface AboutViewController : MDMenuChildViewController @interface AdvisoryViewController :MDMenuChildViewController ...... 然后由数组组成菜单: NSArray *viewControllers = [NSArray arrayWithObjects:[[ServicesViewController alloc] initWithNibName:@"ServicesViewController" bundle:nil],[[FavouritViewController alloc] initWithNibName:@"FavouritViewController" bundle:nil],[[ContactUsViewController alloc] initWithNibName:@"ContactUsViewController" bundle:nil],[[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil], nil]; MDMenuViewController *mainViewC = [[MDMenuViewController alloc] initWithChildViewControllers:viewControllers]; 每个子界面都又方法定制菜单标题喝图片: -(NSString*)titleForChildControllerMDMenuViewController:(MDMenuViewController *)menuController { return @"About"; } -(NSString*)iconForChildControllerMDMenuViewController:(MDMenuViewController *)menuController { return @"concept-icon-poster60.png"; } |