drawer的用法_MMDrawerController抽屉侧边栏的简单使用

1.MMDrawerController是一个简单实用的侧边栏第三方类库。

2.在appdelegate页中初始化你需要的左右侧边栏,leftViewController ,mainViewController。

3.在appdelegate中导入头文件#import "MMDrawerController.h"

4.初始化抽屉控制器:

MMDrawerController * drawerController = [[MMDrawerController alloc] initWithCenterViewController: mainViewControllerleftDrawerViewController:leftViewController];

注:由于在MMDrawerController中机会没有涉及到storyboard的内容,如果想用xib来初始化该怎么办呢,方式如下:

以main.storyboard为例:

1.初始化:UIStoryboard*mainStoryboard=[UIStoryboardstoryboardWithName:@"main"bundle: nil];

2.添加到MMDrawerController中:drawerController=[[MMDrawerControlleralloc]initWithCenterViewController:[mainStoryboardinstantiateViewControllerWithIdentifier:@"centerNav"]leftDrawerViewController:[mainStoryboardinstantiateViewControllerWithIdentifier:@"menu"]];

5.设置抽屉的一些属性

//设置左抽屉抽出的宽度

drawerController.maximumLeftDrawerWidth = 200;

//设置抽屉视图VC阴影效果

self.mmDrawController.showsShadow = YES;

6.添加滑动手势,通过滑动手势拉出和收回抽屉。

[drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];

[drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

7.在中心视图添加按钮

1)在中心视图添加头文件

#import "UIViewController+MMDrawerController.h"//第三方封装的头文件

#import "MMDrawerBarButtonItem.h"//第三方封装的头文件

#import "LeftDrawerTableViewController.h"、、左视图头文件

2)创建按钮的方法

-(void)setupLeftMenuButton

{

//创建按钮

MMDrawerBarButtonItem * leftDrawerButton = [[MMDrawerBarButtonItem alloc] initWithTarget:self action:@selector(leftDrawerButtonPress:)];

//为navigationItem添加LeftBarButtonItem

[self.navigationItem setLeftBarButtonItem:leftDrawerButton animated:YES];

}

3)添加按钮的动作

//抽屉按钮动作

-(void)leftDrawerButtonPress:(id)sender

{

//开关左抽屉

[self.mm_drawerController toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/543662.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【Android】11.3 屏幕旋转和场景变换过程中GridView的呈现

分类:C#、Android、VS2015; 创建日期:2016-02-21 一、简介 实际上,对于布局文件中的View来说,大多数情况下,Android都会自动保存这些状态,并不需要我们都去处理它。这一节仍以GridView为例&…

foss测试_社区概念-与FOSS社区合作时应遵循的准则

foss测试A steady arrangement of strategies and rules is expected to administer FOSS inside an association. These strategies and rules must be deliberately created to protect that all issues that may influence the interests of the association are tended to.…

74ls161中rco是什么_74ls161引脚图与管脚功能表资料

输入输出CRCPLDEPETD3D2D1D0Q3Q2Q1Q00ФФФФФФФФ00001↑0ФФdcbadcba1↑10ФФФФФQ3Q2Q1Q01↑1Ф0ФФФФQ3Q2Q1Q01↑111ФФФФ状态码加1<74LS161功能表>从74LS161功能表功能表中可以知道&#xff0c;当清零端CR“0”&#xff0c;计数器输出Q3、Q2、Q1、Q0立…

html---textarea初始化时就有个table空格以及tab键操作无效

1 初始化时就有一个tab空格这是由于<textarea></textarea>之间的内容不为空的原因&#xff0c;包含空格和换行&#xff0c;否则浏览器会觉得空格或者换行都是文本域的内容。因此书写时需将<textarea></textarea>紧靠在一起。2 tab键对textarea操作无效…

如何使用JavaScript访问对象的键中有空格的对象?

Sometimes your JavaScript object may contain a key having spaces between them. As a key can also be a string and a string may contain spaces, it is very much possible that you encounter this problem. Consider the following object, 有时&#xff0c;您JavaScr…

python信号量怎么用_Python3.X 线程中信号量的使用方法示例

# -*- coding:utf-8 -*-""" Created by FizLin on 2017/07/23/-下午10:59mail: https://github.com/Fiz1994信号量maxconnections 5...pool_sema BoundedSemaphore(valuemaxconnections)Once spawned, worker threads call the semaphores acquire and releas…

Codeforces Round #343 (Div. 2) A. Far Relative’s Birthday Cake 水题

A. Far Relative’s Birthday Cake题目连接&#xff1a; http://www.codeforces.com/contest/629/problem/A Description Doors family is going celebrate Famil Doorss birthday party. They love Famil Door so they are planning to make his birthday cake weird! The cak…

fedora操作系统优缺点_不同类型的操作系统的优缺点

fedora操作系统优缺点There are following types of Operating systems: 有以下几种操作系统&#xff1a; Batch Operating System 批处理操作系统 Time-Sharing Operating System 分时操作系统 Distributed Operating System 分布式操作系统 Network Operating System 网络操…

python radians函数_Python3 radians() 函数

Python3 radians() 函数描述radians() 方法将角度转换为弧度。语法以下是 radians() 方法的语法:import mathmath.radians(x)注意&#xff1a;radians()是不能直接访问的&#xff0c;需要导入 math 模块&#xff0c;然后通过 math 静态对象调用该方法。参数x -- 一个数值。返…

android decorView详解

摘要 一、DecorView为整个Window界面的最顶层View。 二、DecorView只有一个子元素为LinearLayout。代表整个Window界面&#xff0c;包含通知栏&#xff0c;标题栏&#xff0c;内容显示栏三块区域。 三、LinearLayout里有两个FrameLayout子元素。 (20)为标题栏显示界面。只有一个…

c语言1+2+3+4+5_C程序来计算系列1+(1 + 2)+(1 + 2 + 3)+(1 + 2 + 3 + 4)+ ... +(1 + 2 + 3 + ... + n)...

c语言12345The series is: 1(12) (123) (1234) ... (123...n), we have to find out the sum up to N terms. 该序列是&#xff1a; 1(1 2)(1 2 3)(1 2 3 4) ... (1 2 3 ... n) &#xff0c;我们有找出N个项之和。 Solution: 解&#xff1a; We know the sum of n…

3dmax批量导入obj_ArcGIS 与 3DMax 结合建模

整体技术思路是将项目区二维的CAD测绘底图&#xff0c;通过整理导入到3DMax中&#xff0c;根据CAD底图为基础&#xff0c;绘制三维数字模型。利用Photoshop 平面图像处理软件&#xff0c;对现场采集的照片进行修整&#xff0c;为三维模型制作表面贴图。最终把贴好材质的三维楼体…

iOS对象属性详解

oc对象的一些属性&#xff1a; retain,strong, copy,weak,assign&#xff0c;readonly, readwrite, unsafe_unretained下面来分别讲讲各自的作用和区别&#xff1a;retain&#xff0c;计数器加1&#xff0c; (增加一个指向内存的指针) 对应release&#xff08;计数器&#xff0…

给定一个由n个数字组成的数组,请检查是否存在重复项

This is a searching problem which can be solved using brute force approach. But here we are going to see use of hash table to solve such searching problems at lower time complexity. 这是一个搜索问题&#xff0c;可以使用蛮力方法解决。 但是在这里&#xff0c;我…

字符串乘一个数_【思维拓展】三位数乘两位数,构造最大积和最小积

前面袁老师给大家讲了一个重要结论&#xff0c;并运用这个结论来解决问题&#xff0c;构造两位数乘两位数最大积和最小积的问题。今天&#xff0c;更进一步&#xff0c;三位数乘两位数中&#xff0c;如何构造最大积和最小的积&#xff1f;【问题引入】用9、8、6、5、4这五个数字…

ios 微信支付

服务器签名版本 官方已经是建议使用服务器签名来接入微信支付&#xff0c;实际上从安全上考虑&#xff0c;确实是每个客户端不应该知道RAS密钥&#xff0c;也不需要每个客户端都写一遍签名的算法。 服务端接入流程文档&#xff1a;https://pay.weixin.qq.com/wiki/doc/api/app.…

Python | 基于参数和返回值的功能分类

There are following types of the functions based on their parameters and return values: 根据函数的参数和返回值&#xff0c;有以下几种类型的函数&#xff1a; Function with no argument and no return value 没有参数也没有返回值的函数 Function with no argument …

macos可以升级到指定版本吗_承装承修承试可以跨级升级吗?

在建筑行业&#xff0c;通常我们所说的承装承修承试&#xff0c;也就是指承装(修、试)电力设施许可证。承装(修、试)电力设施许可证的功能作用相当于建筑资质&#xff0c;企业需要办理许可证后才能承接电力设施的安装、维护、调试等工程项目。承装(修、试)电力设施许可证可以办…

C#对config配置文件的管理

应用程序配置文件&#xff0c;对于asp.net是 web.config&#xff0c;对于WINFORM程序是App.Config(ExeName.exe.config)。 配置文件&#xff0c;对于程序本身来说&#xff0c;就是基础和依据&#xff0c;其本质是一个xml文件&#xff0c;对于配置文件的操作&#xff0c;从.NET…

16位的数字高字节和低字节_显示掩盖较低和较高的16位数字半字节| 8086微处理器...

16位的数字高字节和低字节Problem: To show masking of lower and higher nibbles of 16bit number using 8086 Microprocessor. 问题&#xff1a;使用8086微处理器显示对16位数字的较高半字节和较低半字节的屏蔽。 Assumption: 假设&#xff1a; Number is stored at memory…