抽屉效果
Posted ZhangDreamK
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了抽屉效果相关的知识,希望对你有一定的参考价值。
这篇博客 是关于一个三方库 RESideMenu的应用
可以做出炫酷的抽屉效果 非常值得一看
#import <RESideMenu/RESideMenu.h>
@interface RootViewController : RESideMenu
#import "RootViewController.h"
@interface RootViewController ()
@end
@implementation RootViewController
- (void)awakeFromNib
// 中间部分
UIViewController * contentVC = [self.storyboard instantiateViewControllerWithIdentifier:@"TabBarViewController"];
self.contentViewController = contentVC;
// 左侧边栏
UIViewController * leftVC = [self.storyboard instantiateViewControllerWithIdentifier:@"LeftSideViewController"];
self.leftMenuViewController = leftVC;
// 右侧边栏
UIViewController * rightVC = [self.storyboard instantiateViewControllerWithIdentifier:@"RightViewController"];
self.rightMenuViewController = rightVC;
// 配置RESideMenu
// 是否允许手势
self.panGestureEnabled = NO;
// 动画时间
// self.animationDuration = 3;
// 设置背景图
self.backgroundImage = [UIImage imageNamed:@"00d32b1f696d5deb664329070db02"];
// 是否允许缩放contentView
self.scaleContentView = YES;
// 设置contentView高度的缩放比例
self.contentViewScaleValue = 0.9;
切换
#import "FirstViewController.h"
#import <RESideMenu.h>
@interface FirstViewController ()
- (IBAction)leftMenuAction:(UIBarButtonItem *)sender;
@end
@implementation FirstViewController
- (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view.
- (void)didReceiveMemoryWarning
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
*/
- (IBAction)leftMenuAction:(UIBarButtonItem *)sender
NSLog(@"%@", self.sideMenuViewController);
[self.sideMenuViewController presentLeftMenuViewController];
以上是关于抽屉效果的主要内容,如果未能解决你的问题,请参考以下文章