GithubHelp home page GithubHelp logo

inzan / mfsidemenu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikefrederick/mfsidemenu

0.0 2.0 0.0 1.72 MB

Facebook-like side menu for iOS

License: Other

Objective-C 99.42% Ruby 0.58%

mfsidemenu's Introduction

#MFSideMenu

This project was inspired by the side-menu functionality seen in the Facebook iOS app. MFSideMenu utilizes view controller containment and gives you a simple API for implementing side-menu functionality. It integrates with storyboard-based apps as well as traditional setups.

=======

ย 

##Features

  • Universal device support (iPhone + iPad)
  • Universal orientation support (Portrait + Landscape)
  • Menus on the left and right side of the screen.
  • Storyboard support
  • View controller containment
  • Works with UINavigationController, UITabBarController, and other types of view controllers
  • Nice set of configuration options
  • Lightweight, simple and readable code.

##Installation

####CocoaPods Add pod 'MFSideMenu' to your Podfile.

####Manually Add the MFSideMenu folder to your project. Add QuartzCore to your project. MFSideMenu uses ARC. If you have a project that doesn't use ARC, just add the -fobjc-arc compiler flag to the MFSideMenu files.

##Usage

###Basic Setup

In your app delegate:

#import "MFSideMenu.h"

MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
                                                containerWithCenterViewController:centerViewController
                                                leftMenuViewController:leftMenuViewController
                                                rightMenuViewController:rightMenuViewController];
self.window.rootViewController = container;
[self.window makeKeyAndVisible];

###Opening & Closing Menus

// toggle the left side menu
[self.menuContainerViewController toggleLeftSideMenuCompletion:^{}];
// toggle the right side menu
[self.menuContainerViewController toggleRightSideMenuCompletion:^{}];
// close the side menu
[self.menuContainerViewController setMenuState:MFSideMenuStateClosed completion:^{}];
// open the left side menu
[self.menuContainerViewController setMenuState:MFSideMenuStateLeftMenuOpen completion:^{}];
// open the right side menu
[self.menuContainerViewController setMenuState:MFSideMenuStateRightMenuOpen completion:^{}];

###Pan Modes

You can specify which areas you want to allow pan gestures on:

// enable panning on the center view controllers & the side menus (this is the default behavior):
menuContainerViewController.panMode = MFSideMenuPanModeCenterViewController | MFSideMenuPanModeSideMenu;

// disable panning on the side menus, only allow panning on the center view controller:
menuContainerViewController.panMode = MFSideMenuPanModeCenterViewController;

// disable all panning
menuContainerViewController.panMode = MFSideMenuPanModeNone;

###Panning Custom Views

You can add panning to any view like so:

[panView addGestureRecognizer:[self.menuContainerViewController panGestureRecognizer]];

###Listening for Menu Events

You can listen for menu state event changes (i.e. menu will open, menu did open, etc.). See MFSideMenuContainerViewController.h for the different types of events.

[[NSNotificationCenter defaultCenter] addObserver:self
                                            selector:@selector(menuStateEventOccurred:)
                                                name:MFSideMenuStateNotificationEvent
                                              object:nil];
- (void)menuStateEventOccurred:(NSNotification *)notification {
    MFSideMenuStateEvent event = [[[notification userInfo] objectForKey:@"eventType"] intValue];
    MFSideMenuContainerViewController *containerViewController = notification.object;
    // ...
}

###Menu Slide Animation

With this option enabled, the side menus will slide in & out with the center view controller. This effect is similar to the Wunderlist side menu.

// enable the menu slide animation
[menuContainerViewController setMenuSlideAnimationEnabled:YES];

// control the exaggeration of the menu slide animation
[menuContainerViewController setMenuSlideAnimationFactor:3.0f];

###Shadow

MFSideMenu gives you the option to show a shadow between the center view controller & the side menus.

// enable/disable the shadow
[menuContainerViewController.shadow setEnabled:YES];

// set the radius of the shadow
[menuContainerViewController.shadow setRadius:10.0f];

// set the color of the shadow
[menuContainerViewController.shadow setColor:[UIColor blackColor]];

// set the opacity of the shadow
[menuContainerViewController.shadow setOpacity:0.75f];

##Contact

@mike_frederick

mfsidemenu's People

Contributors

chien avatar chourobin avatar luugiathuy avatar mbinna avatar rayfix avatar shir avatar timzai avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.