-
a side menu navigation with neat animation .
the side menu slides from the right , and the visible content view controller shrinks and slides to the left ,and the content view controller slide animation can be disabled .
-
each content view controller can push other view controllers and pop them again like a UINaviagationController except that its not a UINaviagationController.
each content view controller is a top view controller in a stack of its own so you can push on its stack other view controllers.
[self.menuController pushViewController:anotherController animated:YES];
-
every content view controller is required to provide the MDMenuViewController parent with a title to be shown in the top bar and in its corresponding menu item and icon by conforming to MDMenuViewControllerDelegate protocol and implementing two required methods
-(NSString)titleForChildControllerMDMenuViewController:(MDMenuViewController)menuController;
-(NSString)iconForChildControllerMDMenuViewController:(MDMenuViewController)menuController;
and declaring a property
@property(nonatomic,weak)MDMenuViewController *menuController;
to be able to communicate with the parent MDMenuViewController.
-
you can show a child view controller from the menu programmatically by index like this :
// animation non
[self.menuController showViewChildViewControllerAtIndex:3 withTransitionAnimation:[MDTransitionAnimatorFactorytransitionAnimatorWithType:MDAnimationTypeNone]];
or
//animation from left
[self.menuController showViewChildViewControllerAtIndex:3 withTransitionAnimation:[MDTransitionAnimatorFactorytransitionAnimatorWithType:MDAnimationTypeSlideFromLeft]];
or
//animation from right
[self.menuController showViewChildViewControllerAtIndex:3 withTransitionAnimation:[MDTransitionAnimatorFactorytransitionAnimatorWithType:MDAnimationTypeSlideFromRight]];
or
implement the MDTransitionAnimatorProtocol to create your custom animation ! and pass the implementing object.
-
you can customise every aspect of its appearance.
you can customise the menu button , top bar background colour and/or image , back button , the menu view item text colour for selected and un selected states ,menu item background colour and/or image for selected and un selected states.
//****************************** MDMenuViewController customise top bar *****************************
// set main menu button image
[mdMenuViewControllerInstance.topBar.menuBtn setImage:[UIImageimageNamed:@"menu_icon.png"] forState:UIControlStateNormal];
// set back button image
[mdMenuViewControllerInstance.topBar.backBtn setImage:[UIImageimageNamed:@"backBtn.png"] forState:UIControlStateNormal];
// set top bar background color
[mdMenuViewControllerInstance.topBar setBackgroundColor:[UIColor colorWithWhite:0.85 alpha:1.0]];
// set top bar title text color
[mdMenuViewControllerInstance.topBar.titleLbl setTextColor:[UIColor whiteColor]];
// set top bar background image
mdMenuViewControllerInstance.topBar.backgroundImage.image = [UIImage imageNamed:@"topBar.jpg"];
//*******************************************************************************************************
// MDMenuController background view image
mdMenuViewControllerInstance.view.backgroundColor = [UIColor lightGrayColor];
//if you want to disable content view swipt to the side when menu is shown
mdMenuViewControllerInstance.contentViewSwiptToTheSideEnabled = NO;
//****************************** MDMenuViewController customise menu view ***************************************
// menu item title text color when selected
[mdMenuViewControllerInstance.menuView setMenuItemTitleTextColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
// menu item title text color when unSelected
[mdMenuViewControllerInstance.menuView setMenuItemTitleTextColor:[UIColor whiteColor] forState:UIControlStateNormal];
// menu item background color when unSelected
[mdMenuViewControllerInstance.menuView setMenuItemBackgroundColor:[UIColor colorWithRed:(46.0f/255.0f) green:(46.0f/255.0f) blue:(46.0f/255.0f) alpha:1.0] forState:UIControlStateNormal];
// menu item background color when selected
[mdMenuViewControllerInstance.menuView setMenuItemBackgroundColor:[UIColor colorWithRed:(47.0f/255.0f) green:(123.0f/255.0f) blue:(154.0f/255.0f) alpha:1.0] forState:UIControlStateHighlighted];
// menu view background color
[mdMenuViewControllerInstance.menuView setBackgroundColor:[UIColor colorWithRed:(46.0f/255.0f) green:(46.0f/255.0f) blue:(46.0f/255.0f) alpha:1.0]];
//disabel ripple animation
[mdMenuViewControllerInstance.menuView setDisableRippleAnimation:YES];
//************************************************************************************************************
-
you can even customize the transition animation between content view controllers.
define your own animation in an NSObject that conform to a certain protocol with one required method.
-
you can define your own menu view if you want full control over its appearance and how its shown .
define your own menu view and set it to the menuView property of the MDMenuViewController instance , as long as it inherits from base class MenuView.