Skip to content

werfe/BEFoldMenuViewController

Repository files navigation

BEFoldMenuViewController

CI Status Version License Platform

Description

Table of Contents

  1. Features
  2. Installation
  3. Supported versions
  4. Usage
  5. Attributes
  6. Public interface
  7. License
  8. Contact

## Features

  • Easy to use, easy to customize.
  • Automatic orientation change adjustments.
  • Storyboard and xib support.

Installation

  • via CocoaPods To run the example project, clone the repo, and run pod install from the Example directory first. BEFoldMenuViewController is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "BEFoldMenuViewController"
  • via werfe: github "werfe/BEFoldMenuViewController".
  • or copy BEFoldMenuViewController folder to your project.
  • iOS 7.0 or later

Programmatically

In AppDelegate.m add some codes below inside didFinishLaunchingWithOptions function

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    //... init homeVC, leftMenu and rightMenu
    
    BEFoldMenuViewController *foldMenu = [[BEFoldMenuViewController alloc] init];
    [foldMenu.view setFrame:[UIScreen mainScreen].bounds];
    foldMenu.topViewController = _leftMenu;
    foldMenu.leftViewController = _homeVC;
    foldMenu.rightViewController = _rightMenu ;
    foldMenu.delegate = _leftMenu;
    return YES;
}

Using Storyboard segue

Step 1. In the storyboard file, choose view controller that you want to have left/right menu effect then change this custom class to BEFoldMenuViewController.

Step 2. Add three custom segues from the Fold Menu View Controller scene, one for the center view controller, one for the left menu view controller and the other for the right menu view controller.

Remember to set all the appropriate attributes of each segue in the Attributes Inspector like that:

Example

Attribute for drawing Value Description
mainViewController UIViewController The center view controller.
leftViewController UIViewController The under left view controller. After setup this attribute, if it not equal nil, value of leftMenuEnabled is automatically set to YES.
rightViewController UIViewController The under right view controller. After setup this attribute, if it not equal nil, value of rightMenuEnabled is automatically set to YES.
menuState BSMenuState Readonly attribute, it returns state of menu include: left menu is showing, right menu is showing or main view is showing.
isDragging BOOL Readonly attribute, it returns YES when user dragging and returns NO when user release their finger.
topShadowColor UIColor Drop shadow color of main view.
topShadowWidth CGFloat Drop shadow width of main view.
topShadowOpacity CGFloat Drop shadow opacity of main view.
animationDuration CGFloat Duration for animation show/hide menu.
Attribute for Left menu Value Description
leftMenuEnabled BOOL Boolean flag, support enable or disable show left menu.
leftMenuWidth CGFloat The width of left menu.
foldEffeectEnabled BOOL Boolean flag, support enable or disable fold effect of left menu.
Attribute for Right menu Value Description
rightMenuEnabled BOOL Boolean flag, support enable or disable show right menu.
rightMenuWidth CGFloat The width of right menu.
Attribute for Storyboard Value Description
mainSegueIdentifier NSString Identifier for custom segue of Storyboard. Use this attribute for project using Storyboar.
leftSegueIdentifier NSString Identifier for custom segue of Storyboard. Use this attribute for project using Storyboar.
rightSegueIdentifier NSString Identifier for custom segue of Storyboard. Use this attribute for project using Storyboar.

###Delegate

The methods declared by the BEFoldMenuDelegate protocol allow the adopting delegate to respond to messages from the BEFoldMenuViewController class and thus respond to, and in some affect, operations such as dragging,show, hide and slide animations.

-(void)foldMenuControllerWillBeginDragging:(UIViewController*) foldMenuController;
-(void)foldMenuControllerWillEndDragging:(UIViewController*) foldMenuController;
-(void)foldMenuControllerDidEndDragging:(UIViewController*) foldMenuController;
-(void)foldMenuControllerWillStartAnimation:(UIViewController*) foldMenuController duration:(CGFloat) duration;
-(void)foldMenuControllerDidEndAnimation:(UIViewController*) foldMenuController;


//Left menu
-(void)foldMenuController:(UIViewController*) foldMenuController didShowLeftMenu:(UIViewController*) leftMenuController;
//Right menu
-(void)foldMenuController:(UIViewController*) foldMenuController didShowRighMenu:(UIViewController*) leftMenuController;
//Hide menu
-(void)foldMenuControllerDidHideMenu:(UIViewController*) foldMenuController;

###Public methods

BEFoldMenuViewController support two method for show/hide left or right menu with animation:

-(void)leftMenuAction;
-(void)rightMenuAction;

You can contact me at email adress werfeee@gmail.com. If you find any issues on the project, you can open a ticket. Pull requests are also welcome.

License

BEFoldMenuViewController is developed by Vũ Trường Giang (aka Werfe) and is released under the MIT license. See the LICENSE file for more details.

In my Sample project, background image is downloaded from ilikewallpaper and Pinterest. Thanks.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published