在《UINavigationController 設(shè)置背景》提到了Drawer,本文將介紹如何快速高效的將drawer引入到項(xiàng)目中來
Drawer相比大家經(jīng)常能看到,優(yōu)點(diǎn)就不用贅言了。直奔主題,MMDrawerController(https://github.com/mutualmobile/MMDrawerController)是我覺得一款比較好用的Drawer開源實(shí)現(xiàn)。
具體使用方法
(1)pod'MMDrawerController','~> 0.5.7',在您的podfile中加入了,然后運(yùn)行pod install,以天朝對(duì)網(wǎng)速大概一杯??的功夫也就OK了。
(2)在項(xiàng)目中引入
#import "MMDrawerController.h"
(3)delegate
UINavigationController * lnav=[[UINavigationController alloc] initWithRootViewController:tvc];
UINavigationController * cnav=[[UINavigationController alloc] initWithRootViewController:tb];
UINavigationController * rnav=[[UINavigationController alloc] initWithRootViewController:rtb];
self.drawerController = [[MMDrawerController alloc]??? initWithCenterViewController:cnav
leftDrawerViewController:lnav
rightDrawerViewController:nil];
(4)簡(jiǎn)單配置一下
[self.drawerController setRestorationIdentifier:@"MMDrawer"];
[self.drawerController setMaximumRightDrawerWidth:200.0];
[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
最好上長(zhǎng)效果圖吧
