iOS 7/8 style side menu with parallax effect.

Related tags

RESideMenu
Overview

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

  • Xcode 6 or higher
  • Apple LLVM compiler
  • iOS 6.0 or higher
  • ARC

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:

$ [sudo] gem install cocoapods
$ pod setup

Change to the directory of your Xcode project:

$ cd /path/to/MyProject
$ touch Podfile
$ edit Podfile

Edit your Podfile and add RESideMenu:

platform :ios, '6.0'
pod 'RESideMenu', '~> 4.0.7'

Install into your Xcode project:

$ pod install

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

$ open 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.

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

  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:
- (void)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:

@property (assign, readwrite, nonatomic) NSTimeInterval animationDuration;
@property (strong, readwrite, nonatomic) UIImage *backgroundImage;
@property (assign, readwrite, nonatomic) BOOL panGestureEnabled;
@property (assign, readwrite, nonatomic) BOOL panFromEdge;
@property (assign, readwrite, nonatomic) NSUInteger panMinimumOpenThreshold;
@property (assign, readwrite, nonatomic) BOOL interactivePopGestureRecognizerEnabled;
@property (assign, readwrite, nonatomic) BOOL scaleContentView;
@property (assign, readwrite, nonatomic) BOOL scaleBackgroundImageView;
@property (assign, readwrite, nonatomic) BOOL scaleMenuView;
@property (assign, readwrite, nonatomic) BOOL contentViewShadowEnabled;
@property (assign, readwrite, nonatomic) UIColor *contentViewShadowColor;
@property (assign, readwrite, nonatomic) CGSize contentViewShadowOffset;
@property (assign, readwrite, nonatomic) CGFloat contentViewShadowOpacity;
@property (assign, readwrite, nonatomic) CGFloat contentViewShadowRadius;
@property (assign, readwrite, nonatomic) CGFloat contentViewScaleValue;
@property (assign, readwrite, nonatomic) CGFloat contentViewInLandscapeOffsetCenterX;
@property (assign, readwrite, nonatomic) CGFloat contentViewInPortraitOffsetCenterX;
@property (assign, readwrite, nonatomic) CGFloat parallaxMenuMinimumRelativeValue;
@property (assign, readwrite, nonatomic) CGFloat parallaxMenuMaximumRelativeValue;
@property (assign, readwrite, nonatomic) CGFloat parallaxContentMinimumRelativeValue;
@property (assign, readwrite, nonatomic) CGFloat parallaxContentMaximumRelativeValue;
@property (assign, readwrite, nonatomic) CGAffineTransform menuViewControllerTransformation;
@property (assign, readwrite, nonatomic) BOOL parallaxEnabled;
@property (assign, readwrite, nonatomic) BOOL bouncesHorizontally;
@property (assign, readwrite, nonatomic) UIStatusBarStyle menuPreferredStatusBarStyle;
@property (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:

- (void)sideMenu:(RESideMenu *)sideMenu didRecognizePanGesture:(UIPanGestureRecognizer *)recognizer;
- (void)sideMenu:(RESideMenu *)sideMenu willShowMenuViewController:(UIViewController *)menuViewController;
- (void)sideMenu:(RESideMenu *)sideMenu didShowMenuViewController:(UIViewController *)menuViewController;
- (void)sideMenu:(RESideMenu *)sideMenu willHideMenuViewController:(UIViewController *)menuViewController;
- (void)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.

Issues
  • Quick swiping results in view completely disappearing

    Quick swiping results in view completely disappearing

    When quickly swiping the view controller to the right it sometimes disappears completely, leaving me with only the menu. When selecting a menu item the only thing happening is the statusbar changing color. To get the view controller back i have to shut down the app and relaunch it.

    (This is from the example project)

    Edit: I can replicate it on iOS6 and iOS7

    Example

    opened by Amnell 16
  • support right menu ? just like Facebook last version on ios7

    support right menu ? just like Facebook last version on ios7

    support right menu ? just like Facebook last version on ios7 thanks.

    enhancement 
    opened by liufsd 12
  • "Unbalanced calls to begin/end appearance transitions for " error

    This happens when you drag the view controller horizontally to reveal the menu partly and don't go all the way but go back to the view controller. It causes the navigation view controller to not update when pushing or popping views from the main navigation view controller.

    opened by ankurp 11
  • [RootViewController re_displayController:frame:]: unrecognized selector

    [RootViewController re_displayController:frame:]: unrecognized selector

    I tried to implement storyboard version, but I'm getting exception: [RootViewController re_displayController:frame:]: unrecognized selector sent to instance 0x9880e10

    in RESideMenu.m, line 116. My RootViewController is subclass of RESideMenu, and I don't see any difference between my and demo project :( Do you have idea what can be wrong?

    P.S. Installed via cocoapods

    opened by mladjan 10
  • presentMenuViewController does not show the menu i case i go forward and back

    presentMenuViewController does not show the menu i case i go forward and back

    Currently i implement an eshop, so i push/pop instances of the same ViewController to navigate in products/categories.

    Each ViewController has a menuViewController (both are included to a RESide Menu). When i push and then i pop a ViewController (going back) the presentMenuViewController is not working - does not open the menu controller. Instead the scroll gesture works as expected.

    Do you have any ideas why the "programmatically way" is not working when a viewController is appeared from back stack?

    opened by mspapant 10
  • Positioning issue

    Positioning issue

    It seems that if the menu is used once the positioning of views isn't completely correct anymore. See the lines at the right and bottom of the screenshot. (Note! You can't see it against a white background like here.)

    Or did I miss anything?

    image

    opened by heijmerikx 8
  • Project alive?

    Project alive?

    Hi @romaonthego,

    is this project still alive? There are many PR's that are currently not merged. If you need assistance please ask!

    Best,

    Felix

    opened by x2on 7
  • How to use this if my root view controller is a UITabBarController?

    How to use this if my root view controller is a UITabBarController?

    Hi.

    This is a question, not an issue. What would be the best way to approach the following structure:

    I am using storyboards and my project contains a tab bar controller, which is the root view controller of the application. The main view controller from which this side menu will be accessible contains a navigation bar (along with the tab bar).

    Thanks!

    opened by aseemsandhu 6
  • Swift Port

    Swift Port

    Anybody interested in helping converting this fantastic iOS component to Swift? I have started converting the basic Objective-C to Swift in this branch: https://github.com/SSA111/RESideMenuSwift

    opened by SSA111 6
  • Added support for menu on both sides/right side only

    Added support for menu on both sides/right side only

    Users can now initialize a RESideMenu instance with a menu on each side, or just a menu on the right side.

    I had to make a significant amount of changes and some of the code could using optimizing, such as the gesture recognition. Feedback would be highly appreciated.

    opened by MahirEusufzai 6
  • problem with iOS 13

    problem with iOS 13

    This is not work on ios13.

    All viewDidAppear not called at all

    opened by mobileonekh 1
  • black status bar when open side menu

    black status bar when open side menu

    when I open side menu a black view appears instead of status bar only on iOS 10

    opened by AhmedOsman00 1
  • Container View's frame

    Container View's frame

    Hello Everyone Can we adjust container view's frame when left menu or right menu was opened.

    opened by cjbhojani 0
  • BUG: UI can't show full screen on iPhoneX .

    BUG: UI can't show full screen on iPhoneX .

    There's screenshot below, how should I solve this issue ? Maybe because of safe-area I guess.

    error1 error2
    opened by XiaoWuTongZhi 2
  • 完美解决RESideMenu二级界面能侧滑的bug(即在二级页面关闭侧滑菜单功能)

    完美解决RESideMenu二级界面能侧滑的bug(即在二级页面关闭侧滑菜单功能)

    简书地址:https://www.jianshu.com/p/9769337d297f

    解决方法是用的@icetime17的,只是代码放的位置不太一样,他的RootViewController是继承自RESideMenu的,而我是自己写了个RESideMenu的分类进行设置的。

    关键代码就👇几句:

    -(void)viewWillAppear:(BOOL)animated

    {

    [super viewWillAppear:animated];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(disableRESideMenu) name:@"disableRESideMenu" object:nil];
    
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enableRESideMenu) name:@"enableRESideMenu" object:nil];
    

    }

    -(void)enableRESideMenu

    { self.panGestureEnabled = YES;}

    -(void)disableRESideMenu

    { self.panGestureEnabled = NO;}

    分类设置完后,在需要关闭侧滑菜单的界面执行👇

    [[NSNotificationCenter defaultCenter] postNotificationName:@"disableRESideMenu" object:nil];

    为什么我要把代码放在viewWillAppear里呢?

    尝试放在viewDidLoad里面,但是程序运行起来黑屏;

    尝试放在+(void)load方法里面,但是崩在发送通知的方法,提示找不到disableRESideMenu方法,为什么呢?因为+(void)load是类方法,不能在里面直接使用对象方法- (void)enableRESideMenu。

    因此,我尝试了一下放在viewWillAppear里面。。。完美解决!!!

    opened by arr0813 0
  • If you want only one view forced landscape left orientation, others keep portrait. I need to add some code to 'RESideMenu.m'.

    If you want only one view forced landscape left orientation, others keep portrait. I need to add some code to 'RESideMenu.m'.

    The code:

    - (UIInterfaceOrientationMask)supportedInterfaceOrientations
    {
        return [self.contentViewController supportedInterfaceOrientations];
    }
    
    opened by HOWIE-CH 0
  • Changing Orientation

    Changing Orientation

    Hi, i need some help on changing the screen orientation. im not sure how to implement so that it can support landscape orientation. Currently, when i launch the project, the screen is in portrait mode, and nothing happen when i tilt the device. Thanks!

    opened by nanaberry 0
  • how to adjust safe area insets bottom for toolbar

    how to adjust safe area insets bottom for toolbar

    opened by ph4br1c3 0
  • Fix for navigation bar when scaling UINavigationController's view in iOS 11

    Fix for navigation bar when scaling UINavigationController's view in iOS 11

    Fixes #303 by adjusting safe area insets during animations

    opened by howelse 2
  • iOS11 issue on slide-over graphic..

    iOS11 issue on slide-over graphic..

    I noted the other thread with a link to a correction, but it changes the fundamental startup of my app (no proper auto-slide over of my main content view), so i am posting here with a thought, and hope for a suggest to speed up my effort:

    The graphic representing the slid-over content view seems to show the navigation bar to be down too far, about 2-5%. If somebody has an idea why, perhaps related to the new inclusion of AutoLayout in navbar/toolbars, that would be great... thanks.

    opened by wdcurry 2
Releases(4.0.7)
Owner
Roman Efimov
Roman Efimov
iOS 7/8 style side menu with parallax effect.

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 control

Roman Efimov 7.2k Jul 23, 2021
Allows the easy creation of animated transition effects when the state of Android UI has changed

android-transition Android-Transition allows the easy creation of view transitions that reacts to user inputs. The library is designed to be general e

Kai 617 Jul 14, 2021
Android Library that lights items for tutorials or walk-throughs etc...

Spotlight Gradle dependencies { implementation 'com.github.takusemba:spotlight:x.x.x' } Usage val spotlight = Spotlight.Builder(this) .setTarg

TakuSemba 3k Jul 27, 2021
swipe display drawer with flowing & bouncing effects.

FlowingDrawer swipe right to display drawer with flowing effects. Download Include the following dependency in your build.gradle file. Gradle: rep

mxn 2.5k Jul 26, 2021
A custom ViewPager title strip which gives continuous feedback to the user when scrolling

SmartTabLayout A custom ViewPager title strip which gives continuous feedback to the user when scrolling. This library has been added some features an

ogaclejapan 6.9k Jul 26, 2021
Android scrollable tabs

Scrollable is a library for an Android application to implement various scrolling technicks. It's all started with scrolling tabs, but now much more c

Dimitry 1.2k Jul 27, 2021
It's an Android library that allows you to use Layout as RadioButton or CheckBox.

Android - CompoundLayout It's an Android library that allows you to use Layout as RadioButton or CheckBox. The librarie is Android 14+ compatible. Gra

null 483 Jul 24, 2021
This library provides a simple way to add a draggable sliding up panel (popularized by Google Music and Google Maps) to your Android application. Brought to you by Umano.

Note: we are not actively responding to issues right now. If you find a bug, please submit a PR. Android Sliding Up Panel This library provides a simp

Umano: News Read To You 9.3k Jul 26, 2021
:octocat: 📃 FoldingCell is a material design expanding content cell inspired by folding paper material made by @Ramotion

FOLDING CELL [JAVA] Expanding content cell with animation inspired by folding paper card material design. We specialize in the designing and coding of

Ramotion 4.8k Jul 30, 2021
Android component which presents a dismissible view from the bottom of the screen

BottomSheet BottomSheet is an Android component which presents a dismissible view from the bottom of the screen. BottomSheet can be a useful replaceme

Flipboard 4.5k Jul 20, 2021
An elegant way to show your menu or messages.

Android View Hover In my opinion, jumping to a new activity to show your menu is a kind of wasting time and life. So, I think, we need a hover view, t

代码家 3.2k Jul 23, 2021
An Android Widget for selecting items that rotate on a wheel.

CursorWheelLayout CursorWheelLayout is an Android library that allows view to be placed on a rotatable wheel. It behaves like a Circular ListView wher

HelloCsl 714 Jul 18, 2021
A backwards compatible implementation of GridLayout for Android

GridLayout Library This library provides a version of GridLayout that works across all versions of Android 1.5+. As a side effect, this library also i

Daniel Lew 187 Jan 26, 2021
Flexbox for Android

FlexboxLayout FlexboxLayout is a library project which brings the similar capabilities of CSS Flexible Box Layout Module to Android. Installation Add

Google 16.9k Aug 2, 2021