(1) MMDrawerController下载地址https://github.com/mutualmobile/MMDrawerController
(2)使用MMDrawerController以TabBarController为中心视图,实现左视图静态cell可以push到对应界面。
(3)问题:遇到的问题是,当以左抽屉为根视图push的时候,会出现不能满屏,center视图依然存在一部分,解决push满屏的情况,就需要以center视图为基础进行push,但是center视图主要是NavigationController如果以 UINavigationController * nav = (UINavigationController)self.mm_drawerController.centerViewController;这种方法去接收中心视图的话,就会出现问题,因为此时的中心视图TabBarController,用下面代码中的方法分部接受中心视图,就可以实现MMDrawerController抽屉第三方库可以基于TabBarController实现抽屉。QQ抽屉的效果就可以实现
1.首先在AppDelegate中导入#import "MMDrawerController.h"
2.//中心视图
MyTabBarController * myTabBar = [[MyTabBarController alloc]init];
//左边抽屉
MyViewController * myVC = [[MyViewController alloc]init];
UINavigationController * myNav = [[UINavigationController alloc]initWithRootViewController:myVC];
MMDrawerController * drawerVC = [[MMDrawerController alloc]initWithCenterViewController:self.myTabBar leftDrawerViewController:myNav];
3.在左边抽屉的ViewController下导入#import "UIViewController+MMDrawerController.h"
4.UITabBarController * nav = (UITabBarController*)self.mm_drawerController.centerViewController;
UINavigationController *vc = nav.viewControllers[0];
AboutViewController *about = [[AboutViewController alloc]init];
[vc pushViewController:about animated:NO];
[self.mm_drawerController closeDrawerAnimated:YES completion:^(BOOL finished) {
[self.mm_drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
}];
5.针对不想要左右抽屉手势的功能,直接实现点击弹出抽屉功能,可以将抽屉的手势设置为没有手势即可
//设置打开和关闭手势
drawerVC.openDrawerGestureModeMask = MMOpenDrawerGestureModeNone;
drawerVC.closeDrawerGestureModeMask = MMOpenDrawerGestureModeNone;