iOS Drawer 让信息更有层次

作者: iCloudEnd | 来源:发表于2015-02-25 09:51 被阅读2211次

在《UINavigationController 设置背景》提到了Drawer,本文将介绍如何快速高效的将drawer引入到项目中来

Drawer相比大家经常能看到,优点就不用赘言了。直奔主题,MMDrawerController(https://github.com/mutualmobile/MMDrawerController)是我觉得一款比较好用的Drawer开源实现。

具体使用方法

(1)pod'MMDrawerController','~> 0.5.7',在您的podfile中加入了,然后运行pod install,以天朝对网速大概一杯🍵的功夫也就OK了。

(2)在项目中引入

#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)简单配置一下

[self.drawerController setRestorationIdentifier:@"MMDrawer"];

[self.drawerController setMaximumRightDrawerWidth:200.0];

[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];

[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

最好上长效果图吧

drawer效果图

相关文章

网友评论

  • Demo6012:请问一下 有源码吗 想看一下Demo是怎么写的 给的代码 有点看不懂
  • f886718d8e26:请问keyWindow的根控制器是哪个?
    潸何吊:@田村kafka self.drawerController

本文标题:iOS Drawer 让信息更有层次

本文链接:https://www.haomeiwen.com/subject/ymauxttx.html