您的位置:首页 > 其它

第七天 抽屉菜单(性能优化版)

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/REFrostedViewController

Storyboards 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"];
}

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  高性能 优化版