iOS 7/8 style side menu with parallax effect.

Related tags

Menu 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.

Comments
  • 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
  • "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
  • 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
  • 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
  • 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
  • ScrollsToTop on TableView

    ScrollsToTop on TableView

    Hi!

    first of all: Great work from your side! Thank you very much :)

    Altough i got a little Problem. When i use RESideMenu with my UITableView the Standard ScrollToTop with Tap on the StatusBar no longer works. Is there something i can do to reactivate this function?

    Thanks for your Help! CrEaK

    opened by CrEaK 5
  • `prefersStatusBarHidden` in UIViewController don't work.

    `prefersStatusBarHidden` in UIViewController don't work.

    When set prefersStatusBarHidden in DEMOSecondViewController, The self.contentViewController.prefersStatusBarHidden doesn't work.

    Because:

    • self.contentViewController is a UINavigationViewController, have to get visibleViewController vaule.
    • when tap left menu second cell, self.contentViewController still is firstViewController's navigation.

    This pull request already fixed them.

    opened by zvving 5
  • RESideMenuStoryboardsExample rotation issues

    RESideMenuStoryboardsExample rotation issues

    Hello,

    I think there are some problems with the menu being positioned incorrectly in certain circumstances.

    Problem 1

    To reproduce problem 1:

    1. Start RESideMenuStoryboardsExample in portrait orientation
    2. Press 'Menu'
    3. You should see this: image

    Now if you restart the app in portrait orientation and then

    1. Rotate device left
    2. Press 'Menu'
    3. Rotate device right
    4. You get the menu at a different position, moved to the top: image

    These two images should look the same.

    Problem 2

    To reproduce problem 2:

    1. Start RESideMenuStoryboardsExample in portrait orientation
    2. Rotate device left
    3. Press 'Menu'
    4. Should look like this image

    Now if you restart the app in portrait orientation and then

    1. Press 'Menu'
    2. Rotate left
    3. You get the following image

    Again, these two images should look the same.

    bug 
    opened by yep 5
  • 完美解决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
  • 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
Releases(4.0.7)
Owner
Roman Efimov
Roman Efimov
Left Side Menu \ Side Bar with modern interface for iOS

SideMenu A customizable, interactive, auto expanding and collapsing side menu fo

Mohammed Albahal 0 Dec 18, 2021
SwiftySideMenu is a lightweight and easy to use side menu controller to add left menu and center view controllers with scale animation based on Pop framework.

SwiftySideMenu SwiftySideMenu is a lightweight, fully customizable, and easy to use controller to add left menu and center view controllers with scale

Hossam Ghareeb 84 Feb 4, 2022
A simple side menu for iOS written in Swift.

ENSwiftSideMenu A lightweight flyover side menu component for iOS with the UIDynamic's bouncing animation, UIGestures and UIBlurEffect. Allows you to

Evgeny Nazarov 1.8k Dec 21, 2022
iOS Interactive Side Menu written in Swift.

Interactive Side Menu A customizable, interactive, auto expanding and collapsing side menu for iOS written in Swift. Here are some of the ways Interac

Handsome 706 Dec 15, 2022
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less.

▤ SideMenu If you like SideMenu, give it a ★ at the top right of this page. SideMenu needs your help! If you're a skilled iOS developer and want to he

Jon Kent 5.4k Dec 29, 2022
A side menu controller written in Swift for iOS

Description SideMenuController is a custom container view controller written in Swift which will display the main content within a center panel and th

Teo 1.2k Dec 29, 2022
Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app small side menu. 🌶

RHSideButtons ?? Library provides easy to implement variation of Android (Material Design) Floating Action Button for iOS. You can use it as your app

Robert Herdzik 166 Nov 14, 2022
Animated side menu with customizable UI

Side Menu Animated side menu with customizable UI. Made in Yalantis. Check this project on dribbble. Check this project on Behance. Requirements iOS 7

Yalantis 2.7k Dec 27, 2022
A simple customizable side menu written in SwiftUI.

NSideMenu Description A simple customizable side menu written in SwiftUI. Give a Star! ⭐ Feel free to request an issue on github if you find bugs or r

null 5 Oct 10, 2022
Simple side option menu with clean code princibles

SwiftUISideMenu Simple side option menu with clean code princibles.

Mehmet Karanlık 12 May 23, 2022
A fully customizable popup style menu for iOS 😎

Guide Check out the documentation and guides for details on how to use. (Available languages:) English 简体中文 What's a better way to know what PopMenu o

Cali Castle 1.5k Dec 30, 2022
A simple circle style menu.

Support CocoaPods. New at 2019.02.25 Use @property (nonatomic, assign) BOOL isOpened; can open or close RoundMenu. use -(void)setButtonEnable:(BOOL)en

zsy78191 383 Dec 21, 2022
Menu controller with expandable item groups, custom position and appearance animation written with Swift. Similar to ActionSheet style of UIAlertController.

Easy to implement controller with expanding menu items. Design is very similar to iOS native ActionSheet presentation style of a UIAlertController. As

Anatoliy Voropay 22 Dec 27, 2022
JNDropDownMenu - Easy to use TableView style dropdown menu.

Overview Swift version of https://github.com/dopcn/DOPDropDownMenu Easy to use TableView style dropdown menu. Setup The only thing you

Javal Nanda 65 Jun 27, 2021
A Slide Menu, written in Swift, inspired by Slide Menu Material Design

Swift-Slide-Menu (Material Design Inspired) A Slide Menu, written in Swift 2, inspired by Navigation Drawer on Material Design (inspired by Google Mat

Boisney Philippe 90 Oct 17, 2020
Slide-Menu - A Simple Slide Menu With Swift

Slide Menu!! Весь интерфейс создан через код

Kirill 0 Jan 8, 2022
EasyMenu - SwiftUI Menu but not only button (similar to the native Menu)

EasyMenu SwiftUI Menu but not only button (similar to the native Menu) You can c

null 10 Oct 7, 2022
Swift-sidebar-menu-example - Create amazing sidebar menu with animation using swift

 SWIFT SIDEBAR MENU EXAMPLE In this project I create a awesome side bar menu fo

Paolo Prodossimo Lopes 4 Jul 25, 2022
Hamburger Menu Button - A hamburger menu button with full customization

Hamburger Menu Button A hamburger menu button with full customization. Inspired by VinhLe's idea on the Dribble How to use it You can config the looks

Toan Nguyen 114 Jun 12, 2022