ECSlidingViewController

ECSlidingViewController是左右抽屉的三方库,可用cocoapods导入。

1、#import "ECSlidingViewController.h"

2、SlideMenuViewController *slideMenu=[[SlideMenuViewController alloc]init];//主界面

LeftMenuViewController *leftMenu=[[LeftMenuViewController alloc]init];//左界面

RightMenuViewController *rightMenu=[[RightMenuViewController alloc]init];//右界面

ECSlidingViewController *slidingVC=[[ECSlidingViewController alloc]init];

[slidingVC setTopViewController:slideMenu];//设置主界面

slidingVC.underLeftViewController=leftMenu;//设置左界面

slidingVC.underRightViewController=rightMenu;//设置右界面

slideMenu.slidingVC=slidingVC;

leftMenu.slidingVC=slidingVC;

leftMenu.view.layer.borderWidth    = 20;

leftMenu.view.layer.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0].CGColor;

leftMenu.view.layer.borderColor    = [UIColor colorWithWhite:0.8 alpha:1.0].CGColor;

leftMenu.edgesForExtendedLayout    = UIRectEdgeTop | UIRectEdgeBottom | UIRectEdgeLeft; 

rightMenu.view.layer.borderWidth    = 20;

rightMenu.view.layer.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0].CGColor;

rightMenu.view.layer.borderColor    = [UIColor colorWithWhite:0.8 alpha:1.0].CGColor;

rightMenu.edgesForExtendedLayout    = UIRectEdgeTop | UIRectEdgeBottom | UIRectEdgeRight; 

[nav.view addGestureRecognizer:slidingVC.panGesture];//添加左滑右滑手势

[nav.view addGestureRecognizer:slidingVC.resetTapGesture];//添加出现左/右界面时点击主界面返回主界面的手势

slidingVC.anchorRightPeekAmount  = 100.0;//右边偏移量

slidingVC.anchorLeftRevealAmount = 250.0;//左边偏移量

delegate.window.rootViewController=slidingVC;//设置为window的rootViewController

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥ios动画全貌。在这里你可以看...
    每天刷两次牙阅读 12,722评论 6 30
  • (一)Masonry介绍 Masonry是一个轻量级的布局框架 拥有自己的描述语法 采用更优雅的链式语法封装自动布...
    木易林1阅读 7,144评论 0 3
  • Masonry是一个轻量级的布局框架,拥有自己的描述语法,采用更优雅的链式语法封装自动布局,简洁明了并具有高可读性...
    3dcc6cf93bb5阅读 5,824评论 0 1
  • 在iOS中随处都可以看到绚丽的动画效果,实现这些动画的过程并不复杂,今天将带大家一窥iOS动画全貌。在这里你可以看...
    F麦子阅读 10,541评论 5 13
  • 1、设置UILabel行间距 NSMutableAttributedString* attrString = [[...
    十年一品温如言1008阅读 5,870评论 0 3

友情链接更多精彩内容