zoukankan      html  css  js  c++  java
  • MMDrawerController(第三方类库)侧边栏的使用

    MMDrawerController是一个小巧简单方便的第三方类库,可以实现简单的侧边栏功能。

    使用方式:

    1.通过cocopad加入类库或者到github上下载。

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

    3.初始化左右和中心三个视图;

     _leftController = [[LeftTableViewController alloc]init];
     _rightController = [[RightViewController alloc]init];
    UIStoryboard *mainStory = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

     

     

    4.将三个视图添加到MMDrawerController上,只需要调用一个方法就能够实现,很简单

     _mmDrawer = [[MMDrawerController alloc]initWithCenterViewController:[mainStory instantiateViewControllerWithIdentifier:@"center"] leftDrawerViewController:_leftController rightDrawerViewController:_rightController];

    5.设置左右侧边栏的宽度:

     [_mmDrawer setMaximumLeftDrawerWidth:200.0];
    [_mmDrawer setMaximumRightDrawerWidth:
    200.0];

    6.添加侧边栏手势

     [_mmDrawer setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
     [_mmDrawer setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

    7.将MMDrawerController设置为根视图

    self.window.rootViewController = _mmDrawer;

    8.在中心视图添加打开关闭侧边栏按钮

     AppDelegate *delegate = [UIApplication sharedApplication].delegate;
    [
    delegate.mmDrawer toggleDrawerSide:MMDrawerSideLeft animated:YES completion:nil];//左侧打开关闭侧边栏方法
  • 相关阅读:
    spacy 语言包离线安装
    linux 进程通信
    UNIX网络编程5 POSIX 消息队列
    UNIX网络编程 12 15共享内存区
    高级UNIX环境编程13 守护进程
    高级UNIX环境编程11 线程
    高级UNIX环境编程10 信号
    高级UNIX环境编程7 进程
    高级UNIX环境编程5 标准IO库
    高级UNIX环境编程4 文件和目录
  • 原文地址:https://www.cnblogs.com/moxuexiaotong/p/4953219.html
Copyright © 2011-2022 走看看