Menu View Controller. It has left, right and main view controllers. Supported tap and pan gestures. Supported storyboards
iOS Slide View
pod 'VPSlideMenu'
if iOS8 or later, Carthage is supported
- Add
github "vascome/VPSlideMenu"
to your Cartfile. - Run
carthage update
.
for more info, see Carthage
Add the VPSlideMenu
files to your project.
Add #import <VPSLideMenu/VPSlideMenu.h>
in your file
UIStoryboard *sBoard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
UIViewController *mainVC = [sBoard instantiateViewControllerWithIdentifier:@"MainVC"];
LeftViewController *leftVC = (LeftViewController*)[sBoard instantiateViewControllerWithIdentifier:@"LeftVC"];
UIViewController *rightVC = [sBoard instantiateViewControllerWithIdentifier:@"RightVC"];
UINavigationController *nvc = [[UINavigationController alloc] initWithRootViewController:mainVC];
leftVC.mainViewController = nvc;
VPSlideMenuViewController *slideMenuController = [[VPSlideMenuViewController alloc] initWithMainViewController:nvc leftViewController:leftVC rightViewController:rightVC];
[slideMenuController setAutomaticallyAdjustsScrollViewInsets:YES];
AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication] delegate];
app.window.rootViewController = slideMenuController;
- put VPSlideMenuViewController in a storyboard.
- add left, right and main vc (see project example)
- setup in code
VPSlideMenuViewController *vc = [[UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]] instantiateInitialViewController];
AppDelegate *app = (AppDelegate*)[[UIApplication sharedApplication] delegate];
((LeftViewController*)vc.leftVC).mainViewController = vc.mainVC;
app.window.rootViewController = vc;
[self slideMenuController]
[self addLeftBarButtonWithImage:[UIImage imageNamed:@"left"]];
[self addrightBarButtonWithImage:[UIImage imageNamed:@"right"]];
VPSlideMenu is available under the MIT license. See the LICENSE file for more info.