iOS -- REsideMenu侧滑视图的使用

第三方资料联系qq:577109832

1.初始化视图

1.初始化方法都是传UIViewController类对象 
2.也就是说中间视图,俩边的侧滑视图的样子完全取决于你的Controller长什么样
3.如果不需要右面侧滑传个nil就OK了
- (id)initWithContentViewController:(UIViewController *)contentViewController
             leftMenuViewController:(UIViewController *)leftMenuViewController
            rightMenuViewController:(UIViewController *)rightMenuViewController;

2.侧滑样式

//解决方案 侧滑对象的contentViewScaleValue设置为1.0f ,其他小数应该知道什么效果了吧
 sideMenuViewController.contentViewScaleValue=1.0f;

3.侧边栏调整大小

//解决方案 侧滑对象的contentViewInPortraitOffsetCenterX设置为100 ,则根据中线向右偏移100 向左就是负的 向右偏移半个屏幕宽你就看不见主视图了
  sideMenuViewController.contentViewInPortraitOffsetCenterX  =100;

4.阴影

/*阴影开关*/
//解决方案 侧滑对象的contentViewShadowEnabled bool类型
 sideMenuViewController.contentViewShadowEnabled = YES;
/*阴影的可设置项 阴影是主视图后面的一个视图*/
//阴影的相关属性
@property (assign, readwrite, nonatomic) UIColor *contentViewShadowColor;//阴影颜色
@property (assign, readwrite, nonatomic) CGSize contentViewShadowOffset;//阴影偏移量 例:偏移量CGSize 中第一个参数为负向左偏移阴影出来的就多了。。。
@property (assign, readwrite, nonatomic) CGFloat contentViewShadowOpacity;//阴影透明度
@property (assign, readwrite, nonatomic) CGFloat contentViewShadowRadius;//阴影圆角

5.侧滑手势

/*侧滑开关*/
// 侧滑对象的panGestureEnabled 是否开启手势sideMenuViewController.panGestureEnabled=YES;
/*侧滑范围*/
// 侧滑对象的panFromEdge 是否在边界有侧滑手势 
sideMenuViewController.panFromEdge=NO;
这个属性就是开了你在大长方形范围可以侧滑导航,没开就只有那俩个小长方形范围可以侧滑出导航 (开着默认的我看才20,可以自己去改)

5.视差

1.只说一个重力时差 不得不说框架考虑的真是。。。例:真机测试一下你垂直拿手机你会看到上面下沉了一小块(厉不厉害 视差啊)
/*视差开关*/
// 侧滑对象的视差是否开启
  sideMenuViewController.parallaxEnabled=YES;//
当然视差有设置大小的属性(视差这个词感觉好高端的样子)
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxMenuMinimumRelativeValue;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxMenuMaximumRelativeValue;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMinimumRelativeValue;
@property (assign, readwrite, nonatomic) IBInspectable CGFloat parallaxContentMaximumRelativeValue;

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
在 APPDelegate 中添加RESideMenu 为根视图

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

self.window= [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];

UINavigationController*navigationController = [[UINavigationControlleralloc]initWithRootViewController:[[ZLBRootViewControlleralloc]init]];

ZLBLeftViewController*leftViewController = [[ZLBLeftViewControlleralloc]init];

RESideMenu*sideMenuViewController = [[RESideMenualloc]initWithContentViewController:navigationControllerleftMenuViewController:leftViewControllerrightMenuViewController:nil];

sideMenuViewController.backgroundImage= [UIImageimageNamed:@"Stars"];

sideMenuViewController.menuPreferredStatusBarStyle=1;// UIStatusBarStyleLightContent

sideMenuViewController.delegate=self;

sideMenuViewController.contentViewShadowColor= [UIColorblackColor];

sideMenuViewController.contentViewShadowOffset=CGSizeMake(0,0);

sideMenuViewController.contentViewShadowOpacity=0.6;

sideMenuViewController.contentViewShadowRadius=12;

sideMenuViewController.contentViewShadowEnabled=YES;
sideMenuViewController.contentViewInPortraitOffsetCenterX = 100;
self.window.rootViewController= sideMenuViewController;

self.window.backgroundColor= [UIColor whiteColor];


[self.windowmakeKeyAndVisible];

returnYES;

}

你可能感兴趣的:(iOS -- REsideMenu侧滑视图的使用)