1.如果不在APPDelegate引入MMDrawerController框架,那么就要注意在需要点击的视图控制器中的对象的获取。

   //工程中标签视图控制器

   MainTabBarViewController *tabbarController = [[MainTabBarViewController alloc] init];

    //初始化视图控制器

    LeftDrawController *leftDrawerController = [[LeftDrawController alloc] init];//左侧视图

     *home = [[HomeViewController alloc] init];

    NewViewController *new = [[NewViewController alloc] init];

    MapViewController *map = [[MapViewController alloc] init];

    MoreViewController *more = [[MoreViewController alloc] init];//几个主界面就都可以有左抽屉效果了

    //存放在数组

    NSArray *array = @[home,new,map,more];

    NSMutableArray *navigationArray = [NSMutableArray array];

    //创建导航栏

    for(int i = 0;i < array.count; i ++){

 

    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:array[i]];

        [navigationArray addObject:nav];

    }

    

    tabbarController.viewControllers = navigationArray;

    //设置中心视图和左拉视图

    self.drawerController = [[MMDrawerController alloc] initWithCenterViewController:tabbarController

                             

                                                            leftDrawerViewController:leftDrawerController

                             

                                                           rightDrawerViewController:nil];

    //手势拉出、拉入

    [self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];

    [self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

    //拉出的宽度

    [self.drawerController setMaximumLeftDrawerWidth:350.0];

    //赋予keyWindow显示

    [UIApplication sharedApplication].keyWindow.rootViewController = self.drawerController;

 

2.在HomeViewController中实现导航栏按钮点击打开和关闭。

  1.引入框架MMDrawerController

  2对象的获取

    MMDrawerController  *MMVC =(MMDrawerController*)[UIApplication sharedApplication].keyWindow.rootViewController;

  3方法的实现                             //往右拉

   [MMVC toggleDrawerSide:MMDrawerSideLeft animated:YES completion:^(BOOL finished) {

        

    }];