• iOS抽屉效果


    源代码下载

    抽屉效果第三方类库下载

    所需第三方类库下载

    側拉栏抽屉效果图

            


    须要导入的头文件:

    #import "MMDrawerController.h"
    #import "MMExampleDrawerVisualStateManager.h"
    代码实现:

    首先须要创建三个试图控制器

    //主视图
        FirstViewController *firstVC = [[FirstViewController alloc] init];
        //左边视图
        SecondViewController *secondVC = [[SecondViewController alloc] init];
        //右边视图
        ThirdViewController *thirdVC = [[ThirdViewController alloc] init];
        
        CustomizedNavigationController *navigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:firstVC];
        
        CustomizedNavigationController *leftNavigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:secondVC];
    
        CustomizedNavigationController *rightNavigationVC = [[CustomizedNavigationController alloc] initWithRootViewController:thirdVC];
    
        //抽屉管理 第三方
        //该第三方既能够仅仅实现打开左側栏也能够实现打开右側栏,还能够同一时候都实现
        MMDrawerController *rooVC = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:leftNavigationVC rightDrawerViewController:rightNavigationVC];
        
        //仅仅实现打开左側栏
        //MMDrawerController *rooVCLeft = [[MMDrawerController alloc] initWithCenterViewController:navigationVC leftDrawerViewController:firstVC];
        //仅仅实现打开右側栏
        //MMDrawerController *rooVCRight = [[MMDrawerController alloc] initWithCenterViewController:navigationVC rightDrawerViewController:thirdVC];
        
        //指定window的根视图
        self.window.rootViewController = rooVC;
        //測了门的宽度
        [rooVC setMaximumLeftDrawerWidth:270];
        //设置側拉门开与关的动画
        [rooVC setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
        [rooVC setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
        //側开内容展示效果
        //设置向左滑动打开右側栏
        [[MMExampleDrawerVisualStateManager sharedManager] setRightDrawerAnimationType:MMDrawerAnimationTypeNone];
        //设置向右滑动打开左側栏
        [[MMExampleDrawerVisualStateManager sharedManager] setLeftDrawerAnimationType:MMDrawerAnimationTypeNone];
        
        [rooVC setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
            MMDrawerControllerDrawerVisualStateBlock block;
            block = [[MMExampleDrawerVisualStateManager sharedManager]
                     drawerVisualStateBlockForDrawerSide:drawerSide];
            if(block){
                block(drawerController, drawerSide, percentVisible);
            }
    
        }];
    




  • 相关阅读:
    【分享】IT产业中的三大定理(二) —— 安迪&比尔定理 (Andy and Bill's Law)
    【分享】IT产业中的三大定理(一) —— 摩尔定理(Moore's Law)
    Linux(Ubuntu)下也能用搜狗输入法了!!!
    聊聊付费软件
    JSP中使用Spring注入的Bean时需要注意的地方
    Spark (十二) Spark Streaming详解
    Kafka(一) 初识
    Spark (十一) spark使用hive的元数据信息
    Spark (十) Spark 的种类型Join
    Spark 学习(九) SparkSQL 函数自定义和数据源
  • 原文地址:https://www.cnblogs.com/blfshiye/p/5391665.html
Copyright © 2020-2023  润新知