第七天 抽屉菜单(性能优化版)
2016-06-03 09:25
155 查看
开源库 RESideMenu
https://github.com/romaonthego/RESideMenu使用
Code
In your AppDelegate’s - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions create the view controller and assign content and menu view controllers.// Create content and menu controllers // DEMONavigationController *navigationController = [[DEMONavigationController alloc] initWithRootViewController:[[DEMOHomeViewController alloc] init]]; DEMOLeftMenuViewController *leftMenuViewController = [[DEMOLeftMenuViewController alloc] init]; DEMORightMenuViewController *rightMenuViewController = [[DEMORightMenuViewController alloc] init]; // Create side menu controller // RESideMenu *sideMenuViewController = [[RESideMenu alloc] initWithContentViewController:navigationController leftMenuViewController:leftMenuViewController rightMenuViewController:rightMenuViewController]; sideMenuViewController.backgroundImage = [UIImage imageNamed:@"Stars"]; // Make it a root controller // self.window.rootViewController = sideMenuViewController;Present the menu view controller:
[self.sideMenuViewController presentLeftMenuViewController];or
[self.sideMenuViewController presentRightMenuViewController];Switch content view controllers:
#import <RESideMenu/RESideMenu.h> .... [self.sideMenuViewController setContentViewController:viewController animated:YES]; [self.sideMenuViewController hideMenuViewController];
Storyboards Example
Create a subclass of RESideMenu. In this example we call it DEMORootViewController. In the Storyboard designate the root view’s owner as DEMORootViewController. Make sure to #import “RESideMenu.h” in DEMORootViewController.h.Add more view controllers to your Storyboard, and give them identifiers “leftMenuViewController”, “rightMenuViewController” and “contentViewController”. Note that in the new XCode the identifier is called “Storyboard ID” and can be found in the Identity inspector.Add a method awakeFromNib to DEMORootViewController.m with the following code:- (void)awakeFromNib { self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"]; self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"leftMenuViewController"]; self.rightMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"rightMenuViewController"]; }
左侧滑动抽屉菜单
08 July 2015开源库 REFrostedViewController
https://github.com/romaonthego/REFrostedViewControllerStoryboards Example
Create a subclass of REFrostedViewController. In this example we call it DEMORootViewController.In the Storyboard designate the root view’s owner as DEMORootViewController.Make sure to #import “REFrostedViewController.h” in DEMORootViewController.h.Add more view controllers to your Storyboard, and give them identifiers “menuController” and “contentController”.4000Note that in the new XCode the identifier is called “Storyboard ID” and can be found in the Identity inspector.Add a method awakeFromNib to DEMORootViewController.m with the following code:- (void)awakeFromNib { self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentController"]; self.menuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"menuController"]; }
相关文章推荐
- MySQL中实现高性能高并发计数器方案(例如文章点击数)
- 编写高性能Javascript代码的N条建议
- 编写高性能JavaScript(译)
- 高性能WEB开发 图片压缩篇
- 高性能MySQL读书笔记 找出谁持有锁
- 个人录制经常用到的Adobe Audition 3.0 完美者特别优化版
- 写出高性能SQL语句的35条方法分析
- 编写高性能的JavaScript 脚本的加载与执行
- 基于Oracle的高性能动态SQL程序开发
- 创建高性能的 Web 页面
- 你不知道的高性能JAVASCRIPT
- 高性能JavaScript DOM编程(1)
- 高性能javascript
- 高性能MYSQL读书要点摘录_3_Schema与数据类型优化
- C++爱好者博客
- 高性能服务器底层网络通信模块的设计方法
- 分布式系统的特点以及设计理念
- 写出高性能SQL语句的十三条法则