您的位置:首页 > 移动开发 > IOS开发

iOS 自定义抽屉式效果--ViewDeck(SlidingDrawer)实现与使用详解

2016-10-27 16:58 549 查看
本实现抽屉式效果的框架相对gitHub里的IIViewDeck,更加简单易用,实现代码简单,效果好,可以无需修改原项目的任何框架而将本效果无缝式移植进现有的项目中,具体操作如下。

1.首先,上demo代码:下载

2.Xcode打开项目,可以看到RootViewController,LeftViewController,RightViewController,CenterViewController等,在移植过程中,只需把这四个控制器文件及UIImage+ImageEffects这个分类拖入项目中,然后重写程序代理的完成加载方法(或者其他必要的地方)即可,重写代码如下:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];

CenterViewController *centerVC = [[CenterViewController alloc] init];
LeftViewController *leftVC = [LeftViewController new];
RightViewController *rightVC = [RightViewController new];

self.window.rootViewController = [[RootViewController alloc] initWithCenterVC:centerVC rightVC:rightVC leftVC:leftVC];
[self.window makeKeyAndVisible];
return YES;
}


3.此时编译项目即可实现如下的效果:


 

 


4.修改RootViewController,LeftViewController,RightViewController,CenterViewController,实现对应的界面及功能。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息