Skip to content

l0gg3r/AMSlideMenu

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AMSlideMenu

Sliding Menu for iOS by arturdev .

This is a simple library to create sliding menus that can be used in storyboards and support static cells.

Whith this library you can create 3 types of sliding menus:

  1. Slide menu with right menu only.
  2. Slide menu with left menu only.
  3. Slide menu with both left and right menus.

This repo contains project that demonstrate usage of AMSlideMenu .
This project created in Xcode 5 , so this library is fully compatible with iOS 7

USAGE

You can use AMSlideMenu with both static cells and dynamic cell prototypes.

Just follow this steps:

  1. Copy AMSlideMenu/AMSlideMenu folder to your project.
  2. Make a subclass of AMSlideMenuMainViewController. Assume you made MainVC.h and MainVC.m files (like in this project).
  3. Add a UIViewController to your iPhone's or iPad's storyboard and name it's class to MainVC
  4. For Left Menu:
           Add a UITableViewController to your storyboard and name it's class to any class that inherits from
           AMSlideMenuLeftTableViewController. Connect the AMSlideMenuMainViewController with your subclass with a custom        segue of type AMSlideMenuLeftMenuSegue, set the segue identifier to leftMenu.

    For Right Menu:
       Add a UITableViewController to your storyboard and name it's class to any class that inherits from
       AMSlideMenuRightTableViewController. Connect the AMSlideMenuMainViewController with your subclass with a custom        segue of type AMSlideMenuRightMenuSegue, set the segue identifier to rightMenu.

5. To add Content ViewController you have to to do the following:
       • Create your content view controller and embed it in a UINavigationController
       • Connect it to the AMSlideMenuLeftTableViewController or AMSlideMenuRightTableViewController with custom segue          AMSlideMenuContentSegue and set some identifier.
      If you want to use dynamic cells , then you have to perform segues in -tableView:didSelectRowAtIndexPath: method yourself.

6.. In MainVC.m override this methods and return segue identifiers that you setted in previous step:
      -(NSString *)segueIdentifierForIndexPathInLeftMenu:(NSIndexPath *)indexPath;
      -(NSString *)segueIdentifierForIndexPathInRightMenu:(NSIndexPath *)indexPath;

Thats it, you are done.

CUSTOMIZATION

You can easily customize slide menu by overriding needed methods in you MainVC.m , such us:

- (AMPrimaryMenu)primaryMenu;
- (NSIndexPath *)initialIndexPathForLeftMenu;
- (NSIndexPath *)initialIndexPathForRightMenu;
- (NSString *)segueIdentifierForIndexPathInLeftMenu:(NSIndexPath *)indexPath;
- (NSString *)segueIdentifierForIndexPathInRightMenu:(NSIndexPath *)indexPath;
- (void)configureLeftMenuButton:(UIButton *)button;
- (void)configureRightMenuButton:(UIButton *)button;
- (CGFloat)leftMenuWidth;
- (CGFloat)rightMenuWidth;
- (void) configureSlideLayer:(CALayer *)layer;
- (CGFloat) panGestureWarkingAreaPercent;

You cas use this methods in you MainVC.m if you want to open or close left or right menus programmatically:

- (void)openLeftMenu;
- (void)openLeftMenuAnimated:(BOOL)animated;
- (void)openRightMenu;
- (void)openRightMenuAnimated:(BOOL)animated;
- (void)closeLeftMenu;
- (void)closeLeftMenuAnimated:(BOOL)animated;
- (void)closeRightMenu;
- (void)closeRightMenuAnimated:(BOOL)animated;

If you want to get menu's open/close callbacks, then set MainVC's delegate property, and implement protocol named 'AMSlideMenuProtocols'.

@optional
- (void)leftMenuWillOpen;
- (void)leftMenuDidOpen;
- (void)rightMenuWillOpen;
- (void)rightMenuDidOpen;

- (void)leftMenuWillClose;
- (void)leftMenuDidClose;
- (void)rightMenuWillClose;
- (void)rightMenuDidClose;



About

Sliding Menu for iOS (Left and Right menus)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%