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];//左侧打开关闭侧边栏方法
  • 相关阅读:
    Java实现 LeetCode 69 x的平方根
    Java实现 LeetCode 68 文本左右对齐
    Java实现 LeetCode 68 文本左右对齐
    Java实现 LeetCode 68 文本左右对齐
    Java实现 LeetCode 67 二进制求和
    Java实现 LeetCode 67 二进制求和
    Java实现 LeetCode 67 二进制求和
    Java实现 LeetCode 66 加一
    Java实现 LeetCode 66 加一
    CxSkinButton按钮皮肤类
  • 原文地址:https://www.cnblogs.com/moxuexiaotong/p/4953219.html
Copyright © 2011-2022 走看看