nvs

NVSlideMenuController

A slide menu done right for iOS.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

179

Maintenance

Last Commit

5yrs ago

Contributors

7

Package

Dependencies

0

License

MIT

Categories

Readme

NVSlideMenuController

A slide menu done right.

Requirements

  • You can use ARC or not, this library supports both
  • iOS 5.0+

Usage

  • Drop lib/NVSlideMenuController/NVSlideMenuController.{h|m} in your project
  • Add QuartzCore.framework

Create a slide menu

UIViewController *menuViewController = ... ; // Your menu view controller
UIViewController *contentViewController = ... ; // The initial content view controller (home page ?)

NVSlideMenuController *slideMenuController = [[NVSlideMenuController alloc] initWithMenuViewController:menuViewController andContentViewController:contentViewController];

self.window.rootViewController = slideMenuController; // Assuming you are in app delegate did finish launching

Change & show new content from the menu

// Inside your menuViewController
UIViewController *newContentViewController = ... ; // Create & configure your new content view controller (as usual)
[self.slideMenuController closeMenuBehindContentViewController:newContentViewController animated:YES completion:nil];

NVSlideMenuController callbacks

The library provides 4 methods through a UIViewController category. You can override them to manage the slide in/out of the content view controller. It is best described by the provided demo app.

@interface UIViewController (NVSlideMenuControllerCallbacks)

- (void)viewWillSlideIn:(BOOL)animated inSlideMenuController:(NVSlideMenuController *)slideMenuController;
- (void)viewDidSlideIn:(BOOL)animated inSlideMenuController:(NVSlideMenuController *)slideMenuController;
- (void)viewWillSlideOut:(BOOL)animated inSlideMenuController:(NVSlideMenuController *)slideMenuController;
- (void)viewDidSlideOut:(BOOL)animated inSlideMenuController:(NVSlideMenuController *)slideMenuController;

@end

Change the slide direction

You can specify the slide direction by setting the slideDirection property to NVSlideMenuControllerSlideFromLeftToRight or NVSlideMenuControllerSlideFromRightToLeft. The views will update accordingly if needed (look at the demo app for a taste). You can also animate the change.

// Inside your view controller (menu or content)
[self.slideMenuController setSlideDirection:NVSlideMenuControllerSlideFromRightToLeft animated:YES];
// or more simply...
self.slideMenuController.slideDirection = NVSlideMenuControllerSlideFromRightToLeft; // this one will not animate

Enable/Disable the pan gesture

You could need to disable the pan gesture, for example when your content view controller has a table view with reorder control (see issue #2).

// For example when your view controller enter in editing mode
- (void)setEditing:(BOOL)editing animated:(BOOL)animated
{
    [super setEditing:editing animated:animated];

    if (editing)
        self.slideMenuController.panGestureEnabled = NO;
}

For more have a look at the demo app ;-]

Author

Nicolas VERINAUD (@nverinaud)

License

Released under the MIT License. For more see LICENSE.md.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100