Convert Figma logo to code with AI

mikefrederick logoMFSideMenu

Facebook-like side menu for iOS

1,167
291
1,167
65

Top Related Projects

5,298

Animate in Xcode without code

iOS 7/8 style side menu with parallax effect.

A lightweight, easy to use, Side Drawer Navigation Controller

Sliding Menu for iOS (Left and Right menus). Multiple storyboards and XIBs support.

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

Quick Overview

MFSideMenu is an iOS library that provides a customizable side menu implementation for iOS applications. It allows developers to easily add sliding side menus to their apps, supporting both left and right side menus with various configuration options.

Pros

  • Easy to integrate and use in iOS projects
  • Supports both left and right side menus
  • Highly customizable with various configuration options
  • Smooth animations and gestures for menu interactions

Cons

  • Not actively maintained (last update was in 2017)
  • May require additional work to ensure compatibility with newer iOS versions
  • Limited documentation and examples
  • Lacks some advanced features found in more modern side menu libraries

Code Examples

  1. Setting up a basic side menu:
let sideMenuContainerViewController = MFSideMenuContainerViewController()
sideMenuContainerViewController.centerViewController = UINavigationController(rootViewController: MainViewController())
sideMenuContainerViewController.leftMenuViewController = LeftMenuViewController()
sideMenuContainerViewController.rightMenuViewController = RightMenuViewController()
  1. Toggling the left menu:
sideMenuContainerViewController.toggleLeftSideMenuCompletion { 
    print("Left menu toggled")
}
  1. Customizing menu width and shadow:
sideMenuContainerViewController.leftMenuWidth = 280
sideMenuContainerViewController.menuSlideAnimationFactor = 0.3
sideMenuContainerViewController.menuShadowOpacity = 0.8
sideMenuContainerViewController.menuShadowRadius = 5

Getting Started

  1. Install MFSideMenu using CocoaPods by adding the following to your Podfile:
pod 'MFSideMenu'
  1. Import MFSideMenu in your Swift file:
import MFSideMenu
  1. Set up the side menu container and view controllers:
let mainViewController = MainViewController()
let leftMenuViewController = LeftMenuViewController()
let rightMenuViewController = RightMenuViewController()

let navigationController = UINavigationController(rootViewController: mainViewController)
let sideMenuContainerViewController = MFSideMenuContainerViewController(centerViewController: navigationController, leftMenuViewController: leftMenuViewController, rightMenuViewController: rightMenuViewController)

window?.rootViewController = sideMenuContainerViewController
  1. Customize the menu appearance and behavior as needed using the available properties and methods of MFSideMenuContainerViewController.

Competitor Comparisons

5,298

Animate in Xcode without code

Pros of Canvas

  • More comprehensive animation and UI customization options
  • Supports a wider range of UI elements and interactions
  • Actively maintained with regular updates

Cons of Canvas

  • Steeper learning curve due to more complex API
  • Larger codebase and potentially higher memory footprint
  • May be overkill for simple side menu implementations

Code Comparison

Canvas example:

let animator = Canvas.Animator(duration: 0.3)
animator.addAnimation { context in
    context.view.alpha = 1.0
    context.view.transform = .identity
}
animator.animate()

MFSideMenu example:

[self.sideMenu setMenuWidth:280.0f];
[self.sideMenu presentLeftMenuViewController];

Summary

Canvas offers more advanced animation and UI customization capabilities, making it suitable for complex projects. However, it may be more challenging to implement and could be excessive for basic side menu functionality. MFSideMenu, on the other hand, provides a simpler API focused specifically on side menu implementation, making it easier to use for straightforward menu requirements but limiting in terms of advanced customization options.

iOS 7/8 style side menu with parallax effect.

Pros of RESideMenu

  • More customizable appearance with built-in blur and fade effects
  • Supports both left and right side menus simultaneously
  • Includes gesture-based interactions for opening/closing the menu

Cons of RESideMenu

  • Slightly more complex implementation due to additional features
  • May have a steeper learning curve for beginners
  • Potentially higher memory usage due to more advanced visual effects

Code Comparison

MFSideMenu:

MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
                                                containerWithCenterViewController:centerViewController
                                                leftMenuViewController:leftMenuViewController
                                                rightMenuViewController:rightMenuViewController];

RESideMenu:

RESideMenu *sideMenu = [[RESideMenu alloc] initWithContentViewController:contentViewController
                                                    leftMenuViewController:leftMenuViewController
                                                   rightMenuViewController:rightMenuViewController];
sideMenu.backgroundImage = [UIImage imageNamed:@"Stars"];
sideMenu.menuPreferredStatusBarStyle = UIStatusBarStyleLightContent;

Both libraries offer similar core functionality for implementing side menus in iOS applications. MFSideMenu provides a simpler, more straightforward approach, while RESideMenu offers more advanced customization options and features. The choice between the two depends on the specific requirements of your project and the level of customization needed.

A lightweight, easy to use, Side Drawer Navigation Controller

Pros of MMDrawerController

  • More customizable drawer animations and transitions
  • Supports both left and right drawers simultaneously
  • Better performance for complex drawer layouts

Cons of MMDrawerController

  • Steeper learning curve due to more complex API
  • Requires more setup code for basic functionality
  • Less frequently updated compared to MFSideMenu

Code Comparison

MFSideMenu:

MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
    containerWithCenterViewController:centerViewController
    leftMenuViewController:leftMenuViewController
    rightMenuViewController:rightMenuViewController];

MMDrawerController:

MMDrawerController *drawerController = [[MMDrawerController alloc]
    initWithCenterViewController:centerViewController
    leftDrawerViewController:leftViewController
    rightDrawerViewController:rightViewController];
[drawerController setMaximumLeftDrawerWidth:260.0];
[drawerController setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
[drawerController setCloseDrawerGestureModeMask:MMCloseDrawerGestureModeAll];

MMDrawerController offers more granular control over drawer behavior and gestures, but requires more initial setup. MFSideMenu provides a simpler API for basic drawer functionality, making it easier to implement quickly.

Sliding Menu for iOS (Left and Right menus). Multiple storyboards and XIBs support.

Pros of AMSlideMenu2

  • Supports both left and right side menus simultaneously
  • Allows customization of menu width and animation duration
  • Provides delegate methods for menu open/close events

Cons of AMSlideMenu2

  • Less actively maintained (last update was several years ago)
  • Documentation is limited compared to MFSideMenu
  • May have compatibility issues with newer iOS versions

Code Comparison

MFSideMenu:

MFSideMenuContainerViewController *container = [MFSideMenuContainerViewController
                                                containerWithCenterViewController:centerViewController
                                                leftMenuViewController:leftMenuViewController
                                                rightMenuViewController:rightMenuViewController];

AMSlideMenu2:

AMSlideMenuMainViewController *mainViewController = [[AMSlideMenuMainViewController alloc] init];
[mainViewController addLeftMenuViewController:leftMenuViewController];
[mainViewController addRightMenuViewController:rightMenuViewController];

Both libraries offer similar functionality for creating side menus in iOS applications. MFSideMenu provides a more straightforward setup process with a single method call, while AMSlideMenu2 requires separate method calls for adding left and right menus. MFSideMenu has better documentation and more recent updates, making it potentially more reliable for current iOS development. However, AMSlideMenu2 offers more customization options out of the box, which may be beneficial for developers requiring fine-tuned control over menu behavior and appearance.

iOS Slide Menu View based on Google+, iQON, Feedly, Ameba iOS app. It is written in pure swift.

Pros of SlideMenuControllerSwift

  • Written in Swift, providing better performance and type safety
  • Supports both left and right side menus simultaneously
  • Offers customizable animation options for menu transitions

Cons of SlideMenuControllerSwift

  • Less mature and potentially less stable than MFSideMenu
  • May have a steeper learning curve for developers new to Swift
  • Limited documentation compared to MFSideMenu

Code Comparison

SlideMenuControllerSwift:

let slideMenuController = SlideMenuController(mainViewController: mainViewController, leftMenuViewController: leftMenuViewController, rightMenuViewController: rightMenuViewController)
self.window?.rootViewController = slideMenuController
self.window?.makeKeyAndVisible()

MFSideMenu:

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

The code comparison shows that both libraries have similar setup processes, but SlideMenuControllerSwift uses Swift syntax while MFSideMenu uses Objective-C. SlideMenuControllerSwift's implementation is slightly more concise and type-safe due to Swift's language features.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

#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