Scout24/RESideMenu

Name: RESideMenu

Owner: AutoScout24

Owner: AutoScout24

Description: iOS 7 style side menu with parallax effect.

Created: 2014-09-03 11:04:35.0

Updated: 2016-06-24 07:29:12.0

Pushed: 2016-06-24 07:29:09.0

Homepage:

Size: 8640

Language: Objective-C

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

RESideMenu

iOS 7/8 style side menu with parallax effect inspired by Dribbble shots (first and second).

Since version 4.0 you can add menu view controllers on both left and right sides of your content view controller.

RESideMenu Screenshot RESideMenu Screenshot

Requirements
Demo

Build and run the RESideMenuExample project in Xcode to see RESideMenu in action. For storyboards integration demo, build and run RESideMenuStoryboardsExample.

Installation
CocoaPods

The recommended approach for installating RESideMenu is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation. For best results, it is recommended that you install via CocoaPods >= 0.28.0 using Git >= 1.8.0 installed via Homebrew.

Install CocoaPods if not already available:

udo] gem install cocoapods
d setup

Change to the directory of your Xcode project:

 /path/to/MyProject
uch Podfile
it Podfile

Edit your Podfile and add RESideMenu:

form :ios, '6.0'
'RESideMenu', '~> 4.0.7'

Install into your Xcode project:

d install

Open your project in Xcode from the .xcworkspace file (not the usual project file)

en MyProject.xcworkspace

Please note that if your installation fails, it may be because you are installing with a version of Git lower than CocoaPods is expecting. Please ensure that you are running Git >= 1.8.0 by executing git --version. You can get a full picture of the installation details by executing pod install --verbose.

Manual Install

All you need to do is drop RESideMenu files into your project, and add #include "RESideMenu.h" to the top of classes that will use it.

Example Usage

In your AppDelegate's - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions create the view controller and assign content and menu view controllers.

reate content and menu controllers

NavigationController *navigationController = [[DEMONavigationController alloc] initWithRootViewController:[[DEMOHomeViewController alloc] init]];
LeftMenuViewController *leftMenuViewController = [[DEMOLeftMenuViewController alloc] init];
RightMenuViewController *rightMenuViewController = [[DEMORightMenuViewController alloc] init];

reate side menu controller

deMenu *sideMenuViewController = [[RESideMenu alloc] initWithContentViewController:navigationController
                                                            leftMenuViewController:leftMenuViewController
                                                           rightMenuViewController:rightMenuViewController];
MenuViewController.backgroundImage = [UIImage imageNamed:@"Stars"];

ake it a root controller

.window.rootViewController = sideMenuViewController;

Present the menu view controller:

f.sideMenuViewController presentLeftMenuViewController];

or

f.sideMenuViewController presentRightMenuViewController];

Switch content view controllers:

ort <RESideMenu/RESideMenu.h>



f.sideMenuViewController setContentViewController:viewController animated:YES];
f.sideMenuViewController hideMenuViewController];
Storyboards Example
  1. Create a subclass of RESideMenu. In this example we call it DEMORootViewController.
  2. In the Storyboard designate the root view's owner as DEMORootViewController.
  3. Make sure to #import "RESideMenu.h" in DEMORootViewController.h.
  4. 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.
  5. Add a method awakeFromNib to DEMORootViewController.m with the following code:
oid)awakeFromNib

self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"];
self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"leftMenuViewController"];
self.rightMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"rightMenuViewController"];

Customization

You can customize the following properties of RESideMenu:

perty (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
perty (strong, readwrite, nonatomic) UIImage *backgroundImage;
perty (assign, readwrite, nonatomic) BOOL panGestureEnabled;
perty (assign, readwrite, nonatomic) BOOL panFromEdge;
perty (assign, readwrite, nonatomic) NSUInteger panMinimumOpenThreshold;
perty (assign, readwrite, nonatomic) BOOL interactivePopGestureRecognizerEnabled;
perty (assign, readwrite, nonatomic) BOOL scaleContentView;
perty (assign, readwrite, nonatomic) BOOL scaleBackgroundImageView;
perty (assign, readwrite, nonatomic) BOOL scaleMenuView;
perty (assign, readwrite, nonatomic) BOOL contentViewShadowEnabled;
perty (assign, readwrite, nonatomic) UIColor *contentViewShadowColor;
perty (assign, readwrite, nonatomic) CGSize contentViewShadowOffset;
perty (assign, readwrite, nonatomic) CGFloat contentViewShadowOpacity;
perty (assign, readwrite, nonatomic) CGFloat contentViewShadowRadius;
perty (assign, readwrite, nonatomic) CGFloat contentViewScaleValue;
perty (assign, readwrite, nonatomic) CGFloat contentViewInLandscapeOffsetCenterX;
perty (assign, readwrite, nonatomic) CGFloat contentViewInPortraitOffsetCenterX;
perty (assign, readwrite, nonatomic) CGFloat parallaxMenuMinimumRelativeValue;
perty (assign, readwrite, nonatomic) CGFloat parallaxMenuMaximumRelativeValue;
perty (assign, readwrite, nonatomic) CGFloat parallaxContentMinimumRelativeValue;
perty (assign, readwrite, nonatomic) CGFloat parallaxContentMaximumRelativeValue;
perty (assign, readwrite, nonatomic) CGAffineTransform menuViewControllerTransformation;
perty (assign, readwrite, nonatomic) BOOL parallaxEnabled;
perty (assign, readwrite, nonatomic) BOOL bouncesHorizontally;
perty (assign, readwrite, nonatomic) UIStatusBarStyle menuPreferredStatusBarStyle;
perty (assign, readwrite, nonatomic) BOOL menuPrefersStatusBarHidden;

If you set a backgroundImage, don't forget to set the Menu View Controller's background color to clear color.

You can implement RESideMenuDelegate protocol to receive the following messages:

oid)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer;
oid)sideMenu:(RESideMenu *)sideMenu willShowMenuViewController:(UIViewController *)menuViewController;
oid)sideMenu:(RESideMenu *)sideMenu didShowMenuViewController:(UIViewController *)menuViewController;
oid)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController;
oid)sideMenu:(RESideMenu *)sideMenu didHideMenuViewController:(UIViewController *)menuViewController;
Contact

Roman Efimov

License

RESideMenu is available under the MIT license.

Copyright © 2013 Roman Efimov.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

RESideMenu

iOS 7/8 style side menu with parallax effect inspired by Dribbble shots (first and second).

Since version 4.0 you can add menu view controllers on both left and right sides of your content view controller.

RESideMenu Screenshot RESideMenu Screenshot

Requirements
Demo

Build and run the RESideMenuExample project in Xcode to see RESideMenu in action. For storyboards integration demo, build and run RESideMenuStoryboardsExample.

Installation
CocoaPods

The recommended approach for installating RESideMenu is via the CocoaPods package manager, as it provides flexible dependency management and dead simple installation. For best results, it is recommended that you install via CocoaPods >= 0.28.0 using Git >= 1.8.0 installed via Homebrew.

Install CocoaPods if not already available:

udo] gem install cocoapods
d setup

Change to the directory of your Xcode project:

 /path/to/MyProject
uch Podfile
it Podfile

Edit your Podfile and add RESideMenu:

form :ios, '6.0'
'RESideMenu', '~> 4.0.7'

Install into your Xcode project:

d install

Open your project in Xcode from the .xcworkspace file (not the usual project file)

en MyProject.xcworkspace

Please note that if your installation fails, it may be because you are installing with a version of Git lower than CocoaPods is expecting. Please ensure that you are running Git >= 1.8.0 by executing git --version. You can get a full picture of the installation details by executing pod install --verbose.

Manual Install

All you need to do is drop RESideMenu files into your project, and add #include "RESideMenu.h" to the top of classes that will use it.

Example Usage

In your AppDelegate's - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions create the view controller and assign content and menu view controllers.

reate content and menu controllers

NavigationController *navigationController = [[DEMONavigationController alloc] initWithRootViewController:[[DEMOHomeViewController alloc] init]];
LeftMenuViewController *leftMenuViewController = [[DEMOLeftMenuViewController alloc] init];
RightMenuViewController *rightMenuViewController = [[DEMORightMenuViewController alloc] init];

reate side menu controller

deMenu *sideMenuViewController = [[RESideMenu alloc] initWithContentViewController:navigationController
                                                            leftMenuViewController:leftMenuViewController
                                                           rightMenuViewController:rightMenuViewController];
MenuViewController.backgroundImage = [UIImage imageNamed:@"Stars"];

ake it a root controller

.window.rootViewController = sideMenuViewController;

Present the menu view controller:

f.sideMenuViewController presentLeftMenuViewController];

or

f.sideMenuViewController presentRightMenuViewController];

Switch content view controllers:

ort <RESideMenu/RESideMenu.h>



f.sideMenuViewController setContentViewController:viewController animated:YES];
f.sideMenuViewController hideMenuViewController];
Storyboards Example
  1. Create a subclass of RESideMenu. In this example we call it DEMORootViewController.
  2. In the Storyboard designate the root view's owner as DEMORootViewController.
  3. Make sure to #import "RESideMenu.h" in DEMORootViewController.h.
  4. 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.
  5. Add a method awakeFromNib to DEMORootViewController.m with the following code:
oid)awakeFromNib

self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"];
self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"leftMenuViewController"];
self.rightMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"rightMenuViewController"];

Customization

You can customize the following properties of RESideMenu:

perty (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
perty (strong, readwrite, nonatomic) UIImage *backgroundImage;
perty (assign, readwrite, nonatomic) BOOL panGestureEnabled;
perty (assign, readwrite, nonatomic) BOOL panFromEdge;
perty (assign, readwrite, nonatomic) NSUInteger panMinimumOpenThreshold;
perty (assign, readwrite, nonatomic) BOOL interactivePopGestureRecognizerEnabled;
perty (assign, readwrite, nonatomic) BOOL scaleContentView;
perty (assign, readwrite, nonatomic) BOOL scaleBackgroundImageView;
perty (assign, readwrite, nonatomic) BOOL scaleMenuView;
perty (assign, readwrite, nonatomic) BOOL contentViewShadowEnabled;
perty (assign, readwrite, nonatomic) UIColor *contentViewShadowColor;
perty (assign, readwrite, nonatomic) CGSize contentViewShadowOffset;
perty (assign, readwrite, nonatomic) CGFloat contentViewShadowOpacity;
perty (assign, readwrite, nonatomic) CGFloat contentViewShadowRadius;
perty (assign, readwrite, nonatomic) CGFloat contentViewScaleValue;
perty (assign, readwrite, nonatomic) CGFloat contentViewInLandscapeOffsetCenterX;
perty (assign, readwrite, nonatomic) CGFloat contentViewInPortraitOffsetCenterX;
perty (assign, readwrite, nonatomic) CGFloat parallaxMenuMinimumRelativeValue;
perty (assign, readwrite, nonatomic) CGFloat parallaxMenuMaximumRelativeValue;
perty (assign, readwrite, nonatomic) CGFloat parallaxContentMinimumRelativeValue;
perty (assign, readwrite, nonatomic) CGFloat parallaxContentMaximumRelativeValue;
perty (assign, readwrite, nonatomic) CGAffineTransform menuViewControllerTransformation;
perty (assign, readwrite, nonatomic) BOOL parallaxEnabled;
perty (assign, readwrite, nonatomic) BOOL bouncesHorizontally;
perty (assign, readwrite, nonatomic) UIStatusBarStyle menuPreferredStatusBarStyle;
perty (assign, readwrite, nonatomic) BOOL menuPrefersStatusBarHidden;

If you set a backgroundImage, don't forget to set the Menu View Controller's background color to clear color.

You can implement RESideMenuDelegate protocol to receive the following messages:

oid)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer;
oid)sideMenu:(RESideMenu *)sideMenu willShowMenuViewController:(UIViewController *)menuViewController;
oid)sideMenu:(RESideMenu *)sideMenu didShowMenuViewController:(UIViewController *)menuViewController;
oid)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController;
oid)sideMenu:(RESideMenu *)sideMenu didHideMenuViewController:(UIViewController *)menuViewController;
Contact

Roman Efimov

License

RESideMenu is available under the MIT license.

Copyright © 2013 Roman Efimov.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.