http://www.shangxueba.com/jingyan/3168851.html
// 第一步在AppDelegate.h中
@property (strong ,nonatomic) MMDrawerController * drawerController;
// 然后创建,这里是左中右三个页面,每个页面都用UINavigationController包一层如下
UINavigationController *rightNavi = [[UINavigationController alloc]initWithRootViewController:_search];
[rightNavi setRestorationIdentifier:@"RightNavigationControllerRestorationKey"];
_drawerController = [[MMDrawerController alloc]
initWithCenterViewController:center
leftDrawerViewController:leftNavi
rightDrawerViewController:rightNavi];
[self.drawerController setShowsShadow:NO];
[self.drawerController setRestorationIdentifier:@"MMDrawer"];
// 设置右边页面显示宽度,左边同理
[self.drawerController setMaximumRightDrawerWidth:ScreenWidth];
// 左右滑动,三个页面间切换
[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
// 设为根视图
[self.window setRootViewController:_drawerController];
// 需要注意的是如果使用按钮实现push,pop功能,在左中右三个页面上不能使用self.navigationcontroller.pushviewcontroller而是使用mm自带的 中间页面可用如下代码
[self.mm_drawerController openDrawerSide:MMDrawerSideLeft
animated:YES
completion:^(BOOL finished) {
}];
// openDrawerSide 指的是方向 功能同上面手势功能一样
// 左右页面对应使用返回,例如写在左上角的返回按钮的点击事件里如下
//[button addTarget:self action:@selector(clickLeft) //forControlEvents:UIControlEventTouchUpInside];
// UIBarButtonItem* backItem = [[UIBarButtonItem alloc]//initWithCustomView:button];
[self.navigationItem setLeftBarButtonItem:backItem];
[self.mm_drawerController closeDrawerAnimated:YES completion:^(BOOL finished) {
}];