A simple side menu using UIDynamics. Including gravity, attachment, push, parallax effect and so on.
Learned from MFSideMenu.
Add pod 'GSSideMenu'
to your Podfile.
Add GSSideMenu
folder to your project.
In your app delegate:
#import "GSSideMenu.h"
GSSideMenuViewController *container = [GSSideMenuViewController initWithCenterViewController:centerViewController MenuViewController:menuViewController;
self.window.rootViewController = container;
[self.window makeKeyAndVisible];
- Create a subclass of
GSSideMenu
, for exampleMainViewController
. - Add two view controllers to your storyboard and give them identifiers, for example
@"MenuView"
and@"CenterView"
. - Add a method
awakeFromNib
toMainViewController
with the following code:
- (void)awakeFromNib {
self.menuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MenuView"];
self.centerViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"CenterView"];
}