iOS Life

  • Home
  • ABOUT
  • SERVICES
  • PORTFOLIO
  • BLOG
  • Contact

Framework: Mutual Mobile Drawer Controller

Have you ever wanted to build an app with a styled menu that slides out from the left or right like Facebook and YouTube? Now you can easily add this functionality to your apps with a great framework called Mutual Mobile Drawer Controller (MMDrawerController). It was developed by the fine folks at Mutual Mobile.

MMDrawerController is a side drawer navigation container view controller designed to support the growing number of applications that leverage the side drawer paradigm. This library is designed to exclusively support side drawer navigation in a light-weight, focused approach while exposing the ability to provide custom animations for presenting and dismissing the drawer.

Setting up MMDrawerController

Follow the steps below to get started:
1. Visit the GitHub page here:https://github.com/mutualmobile/MMDrawerController.
2. Pull or download the latest version of the source code.
3. Add the following files into your project:
– MMDrawerBarButtonItem.h
– MMDrawerBarButtonItem.m
– MMDrawerController.h
– MMDrawerController.m
– MMDrawerController+Subclass.h
– MMDrawerVisualState.h
– MMDrawerVisualState.m
– UIViewController+MMDrawerController.h
– UIViewController+MMDrawerController.m
4. Include the following header at the top of your App Delegate:
– #import “MMDrawerController.h”
– #import “MMDrawerVisualState.h”
5. Start coding!

Creating a MMDrawerController is as easy as creating a center view controller and the drawer view controllers, and init’int the drawer. Add this to your App Delgate since the drawerController should be your root controller within your app.

@interface MMAppDelegate ()

@property (nonatomic,strong) MMDrawerController * drawerController;

@end

@implementation MMAppDelegate
-(BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
    UIViewController * leftSideDrawerViewController = [[MMExampleLeftSideDrawerViewController alloc] init];
    
    UIViewController * centerViewController = [[MMExampleCenterTableViewController alloc] initWithStyle:UITableViewStyleGrouped];
    
    UIViewController * rightSideDrawerViewController = [[MMExampleRightSideDrawerViewController alloc] init];
    
    UINavigationController * navigationController = [[UINavigationController alloc] initWithRootViewController:centerViewController];
    [navigationController setRestorationIdentifier:@"MMExampleCenterNavigationControllerRestorationKey"];
    
    self.drawerController = [[MMDrawerController alloc]
                                             initWithCenterViewController:navigationController
                                             leftDrawerViewController:leftSideDrawerViewController
                                             rightDrawerViewController:rightSideDrawerViewController];
    [self.drawerController setRestorationIdentifier:@"MMDrawer"];
    [self.drawerController setMaximumRightDrawerWidth:200.0];
    [self.drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
    [self.drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];
    
    [self.drawerController
     setDrawerVisualStateBlock:^(MMDrawerController *drawerController, MMDrawerSide drawerSide, CGFloat percentVisible) {
         MMDrawerControllerDrawerVisualStateBlock block;
         block = [[MMExampleDrawerVisualStateManager sharedManager]
                  drawerVisualStateBlockForDrawerSide:drawerSide];
         if(block){
             block(drawerController, drawerSide, percentVisible);
         }
     }];
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.window setRootViewController:self.drawerController];

    return YES;
}

MMDrawerController is highly customizable. Here’s a quick list of the built in animations:

  • Slide: The drawer slides at the same rate as the center view controller.
  • Slide and Scale: The drawer slides and scales up, while also alpha’ing from 0.0 to 1.0.
  • Swinging Door: The drawer swings in along a hinge on the center view controller.
  • Parallax: The drawer slides in at a slower rate, giving a parallax effect.

There are also some other nice features such as UIGestureRecognizer support, customizable drawer menu button, and a stretch animation effect.

Aug 28, 2013 Brian Coleman
Start-Up StoriesFramework: CoreBackground
You Might Also Like
 
Tutorial: Get Facebook Friends using the Facebook SDK in Swift
 
Tutorial: How To Use Login in Facebook SDK 4.1.x for Swift
7 years ago Frameworksframework, ios, objective-c, tutorial3,921
Follow Me
    
Categories
  • About Me
  • Frameworks
  • My Apps
  • News
  • Strategy
  • Swift
  • Tools
  • Tutorials
  • tvOS
  • Uncategorized
  • Videos
  • Watch
Archives
  • May 2016
  • January 2016
  • October 2015
  • July 2015
  • May 2015
  • April 2015
  • March 2015
  • November 2014
  • October 2014
  • September 2014
  • July 2014
  • June 2014
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
brianjcoleman on Twitter
  • Classix is still holding in the top charts on Apple TV in Canada. #55 Free, #23 Top Grossing. #tvos #appletv #app https://t.co/xuEJiT4rro, Jul 14
  • New Blog Post: "Classix for iPhone, iPad & Apple TV” #iOSDev #ios #swift #swiftlang #SwiftDevs #AppleTV Read here: https://t.co/uF6w3gYOot, May 20
  • New Blog Post: "How to test your app for IPv6 compatibility” #iOSDev #ios #swift #swiftlang #SwiftDevs Read here: https://t.co/SveichSUep, May 6

Recent Posts
  • Classix for iPhone, iPad & Apple TV
  • Tutorial: How to test your app for IPv6 compatibility
  • Tutorial: Testing SSL using Charles Proxy on an iOS Device
  • Tutorial: 3D Touch – Quick Actions in Swift
  • tvOS Tutorial: Top Shelf in Swift
Featured Apps
Classix
Sportsnet
TAGS
tutorialswiftios8iosobjective-cvideostrategygamesframeworknewsappsmonitizeios7applefacebookwatchtoolstvosios9bookdesignsocialapiprovisiontutorialsbooksiapiTunes ConnectIPv6
Search
ABOUT
Brian is a Lead iOS/tvOS Developer from Toronto with over 18 years of multifaceted experience including development, design, business analysis and project management.
MOST VIEWED
Tutorial: How To Use Login in Facebook SDK 4.1.x for Swift
162,592 views
Tutorial: How to test your app for IPv6 compatibility
99,843 views
Tutorial: How to use Auto Layout in Xcode 6
88,709 views
FOLLOW ME
    
Email Subscription
Sign up for my newsletter to receive the latest news and tutorials posted.

Enter your email address:

2013-2017 © Brian Coleman