MMDrawerController在表视图和导航栏中的使用

1.如果不在APPDelegate引入MMDrawerController框架,那么就要注意在需要点击的视图控制器中的对象的获取。

//工程中标签视图控制器

MainTabBarViewController *tabbarController = [[MainTabBarViewController alloc] init];

//初始化视图控制器

LeftDrawController *leftDrawerController = [[LeftDrawController alloc] init];//左侧视图

*home = [[HomeViewController alloc] init];

NewViewController *new = [[NewViewController alloc] init];

MapViewController *map = [[MapViewController alloc] init];

MoreViewController *more = [[MoreViewController alloc] init];//几个主界面就都可以有左抽屉效果了

//存放在数组

NSArray *array = @[home,new,map,more];

NSMutableArray *navigationArray = [NSMutableArray array];

//创建导航栏

for(int i = 0;i < array.count; i ++){

UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:array[i]];

[navigationArray addObject:nav];

}

tabbarController.viewControllers = navigationArray;

//设置中心视图和左拉视图

self.drawerController = [[MMDrawerController alloc] initWithCenterViewController:tabbarController

leftDrawerViewController:leftDrawerController

rightDrawerViewController:nil];

//手势拉出、拉入

[self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];

[self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

//拉出的宽度

[self.drawerController setMaximumLeftDrawerWidth:350.0];

//赋予keyWindow显示

[UIApplication sharedApplication].keyWindow.rootViewController = self.drawerController;

2.在HomeViewController中实现导航栏按钮点击打开和关闭。

1.引入框架MMDrawerController

2对象的获取

MMDrawerController  *MMVC =(MMDrawerController*)[UIApplication sharedApplication].keyWindow.rootViewController;

3方法的实现                             //往右拉

[MMVC toggleDrawerSide:MMDrawerSideLeft animated:YES completion:^(BOOL finished) {

}];

时间: 2024-12-16 09:03:55

MMDrawerController在表视图和导航栏中的使用的相关文章

window10删除导航栏中的onedrive

前面介绍了如何删除导航栏中的"快速访问",对于一个根本用不着的"oneDrive"肯定也得搞掉. 0.处理前: 1.卸载onedrive是不能清除导航栏里面的onedrive的,进入注册表:HKEY_CLASSES_ROOT\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}\ShellFolder 把右侧的Attributes属性的值 f080004d修改为f090004d. 任务管理器中重启资源管理器后就生效了. 2.处理后

magento导航栏中如何加入home主页

magento在导航栏中加入home主页是很简单的,几个步骤即可在magento导航栏中加入home主页! 下面简单介绍下如何在magento导航栏中加入home主页: 首先我们打开对应应用的模板文件,有的是top.phtml,有的是topmenu.phtml文件 改成 getBaseUrl() ?>">首页 ------>或者 Home 就是添加了一个首页的li. 给top link加首页的话,要在customer.xml里修改,把49行的 My AccountMy Acco

android 导航栏中的按钮的点击切换

Drawable drawable_home = res.getDrawable(R.drawable.main_home_selected);//图片 drawable_home.setBounds(0, 0, drawable_home.getMinimumWidth(), drawable_home.getMinimumHeight());//设置边距 home_bt.setCompoundDrawables(null, drawable_home, null, null);//设置按钮b

【iOS开发-22】navigationBar导航栏,navigationItem建立:获取导航栏中的基本文本和button以及各种跳跃

(1)navigationBar导航栏可以被看作是self.navigationController一个属性导航控制器,它可以由点直接表示self.navigationController.navigationBar.当然navigationBar他还是很物业.让我们风格barStyle.背景backgroundColor.frame属性(能够获取宽高这些信息).还能够用setBackgroundImage方法设置背景图片.当然图片多了能够使用clipsToBounds剪裁. (2)但.navi

IOS之导航栏中添加UITextView控件bug

今天遇到一个奇怪的问题,如下: 在导航栏控制器的rootviewcontroller中,添加了一个UITextView控件,代码如下: - (void)viewDidLoad { [super viewDidLoad]; self.title =@"Test"; UITextView *textview = [[UITextViewalloc]init]; textview.frame = CGRectMake(10, 100, 300, 200); textview.backgrou

【IOS】关于处于表视图行单元 contentView 中的 UIButton 短按不产生高亮效果的

在做demo时, 发现 UITableViewCell 中的 UIButton 短按一次看不到默认的变灰效果, 停留稍长才能变灰, 比如twitter官方客户端用户头像, 微博的转评赞三按钮. 微博各类客户端的头像和其他按钮也是这样, 头像很多直接是imageView加手势. 这方面细节处理的最好的是 Instagram 不管短按长按都会灰, 这样才有打击感. 经一番搜索之后得知 UITableView 做为 UIScrollView 的子类,拥有 delaysContentTouches 的布

iOS 如何改变表视图分割线在iOS7中的默认偏移

- (void)viewDidLoad { [super viewDidLoad]; self.automaticallyAdjustsScrollViewInsets = NO; if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { [self.tableView setSeparatorInset:UIEdgeInsetsZero]; } if ([self.tableView respondsToS

iOS Swift&amp;OC 模仿主流App 实现滑动视图隐藏导航栏

简单直接上图上代码 -.- 一个GIF图5M? @property (nonatomic, strong) UITableView *tableViewScroll; @property (nonatomic, assign) double recordDistance; //记录滑动的距离 @property (nonatomic, strong) UIView *customView; @property (nonatomic, strong) UIButton *btn; 创建所需要的视图

xcode 左边导航栏中,类文件后面的标记“A”,&quot;M&quot;,&quot;?&quot;……等符号的含义???

"M" = Locally modified "U" = Updated in repository "A" = Locally added "D" = Locally deleted "I" = Ignored "R" = Replaced in the repository "–" "=" The contents of the folder