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

来源:互联网 发布:菲尔杰克逊 知乎 编辑:程序博客网 时间:2024/06/04 18:12

本实现抽屉式效果的框架相对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,实现对应的界面及功能。

0 0
原创粉丝点击