使用 DDMenuController 类的方法(非常好用的抽屉类)
2024-09-08 10:41:09
关于使用 DDMenuController 类的方法笔记:参考
DDMenuController 是一款非常好用的抽屉类文件。
#pragma mark - 界面配置左右导航条的按钮
//[self configureLeftButton];//配置导航条左边按钮
[self configureRightButton];//配置导航条右边按钮 上面是要在ViewDidLoad 里面调用的 下面是方法的实现
#pragma mark - 界面配置类
//配置导航条左边按钮
- (void)configureLeftButton {
UIBarButtonItem *left = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"qr_toolbar_more_hl"] style:UIBarButtonItemStylePlain target:self action:@selector(handleLeftBack:)];
self.navigationItem.leftBarButtonItem = left; }
//配置导航条右边按钮
- (void)configureRightButton {
UIBarButtonItem *right = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"qr_toolbar_more_hl"] style:UIBarButtonItemStylePlain target:self action:@selector(handleRightBack:)];
self.navigationItem.rightBarButtonItem = right; }
#pragma mark -action
//导航条左边按钮点击事件
- (void)handleLeftBack:(UIBarButtonItem *)item {
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
DDMenuController *menuC = delegate.menuController;
[menuC showLeftController:YES];
}
//导航条右边按钮点击事件
- (void)handleRightBack:(UIBarButtonItem *)item {
AppDelegate *delegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
DDMenuController *menuC = delegate.menuController;
[menuC showRightController:YES];
}
使用方法一
可以使用appdelegate -(void)leftBtnClick
{
[(DDMenuController *)[UIApplication sharedApplication].delegate.window.rootViewController showLeftController:YES]; }
使用方法二
最新文章
- kettle中变量的设置和使用介绍
- Python验证码6位自动生成器
- docker网络配置之自定义网桥
- canvas圆环进度
- 学习javascript基础知识系列第二节 - this用法
- 未能加载文件或程序集 system.data.sqlite 完美解决
- HTML5示例之WebSocket
- 如何使用.net开发一款小而美的O2O移动应用? ——“家庭小秘”APP介绍及采访记录
- 并发框架Disruptor场景应用
- 背水一战 Windows 10 (117) - 后台任务: 后台下载任务
- git中的忽略配置文件中没有忽略该文件,却提交不到服务器上。
- composer Content-Length mismatch
- cocos2dx 3.4 测试例 目录
- 搭建SpringCloud-Eureka 注册中心以及服务提供与调用 快速了解 SpringCloud-Eureka
- dtruss
- 【题解】 Codeforces 919F A Game With Numbers(拓扑排序+博弈论+哈希)
- 关于caffe的安装问题
- css修改select默认样式
- Specified VM install not found: type Standard VM, name jdk1.7
- js判断用户关闭页面或浏览器