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];//左侧打开关闭侧边栏方法
  • 相关阅读:
    three.js_ "Failed to execute 'texImage2D' on 'WebGLRenderingContext': tainted canvases may not be loded."
    three.js为何如此奇妙
    npm install ERR! code E400/E404
    小程序_请求封装network
    css_input[checked]复选框去掉默认样式并添加新样式
    【CSS】凹槽的写法
    剑指Offer_编程题_6
    剑指Offer_编程题_5
    剑指Offer_编程题_4
    剑指Offer_编程题_3
  • 原文地址:https://www.cnblogs.com/moxuexiaotong/p/4953219.html
Copyright © 2011-2022 走看看