TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Mar 2016 |
Maintained by Michael Kamphausen, cg, Tino Rachui, Mathias Köhnke, Mathias Koehnke, Nico Schümann, Heiko Wichmann, Stephan Lerner, Famara Kassama.
Sliding Hamburger Menu like the one in the Facebook App
APLSlideMenuViewController should, but does not have to be rootViewController. It is initialized via Storyboard or with code in your AppDelegate or an APLSlideMenu subclass.
Just drag custom segues like APLSlideMenuContentSegue
, APLSlideMenuLeftMenuSegue
or APLSlideMenuRightMenuSegue
from your APLSlideMenuViewController to your content and menu view controllers and name the segue identifiers content
, leftMenu
or rightMenu
.
If you are using an exception breakpoint and you are not using all three segues, the exception breakpoint will interrupt execution. To prevent this you might want to use a symbolic breakpoint instead. Use the symbol objc_exception_throw
and the condition:
(BOOL)(!(BOOL)[[(NSException *)$r0 reason] hasSuffix:@"has no segue with identifier 'leftMenu'"] && !(BOOL)[[(NSException *)$r0 reason] hasSuffix:@"has no segue with identifier 'rightMenu'"] && !(BOOL)[[(NSException *)$r0 reason] hasSuffix:@"has no segue with identifier 'content'"])
When testing with your simulator instead of a device, you need to deactivate this symbolic breakpoint and add another one, replacing every occurance of $r0
with $eax
in the condition.
Import header file:
#import "APLSlideMenuViewController.h"
Initialization example:
id rootViewController = self.window.rootViewController;
if ([rootViewController isKindOfClass:[APLSlideMenuViewController class]]) {
APLSlideMenuViewController *slideViewController = rootViewController;
// first: configure the slide menu
slideViewController.bouncing = YES;
slideViewController.gestureSupport = APLSlideMenuGestureSupportDrag;
// second: set the leftMenuViewController and / or rightMenuViewController
slideViewController.leftMenuViewController = [MyLeftMenuViewController new];
slideViewController.rightMenuViewController = [MyRightMenuViewController new];
// third: set the contentViewController
slideViewController.contentViewController = [MyContentViewController new];
} else {
NSLog(@"Ups, this shouldn't happen");
}
menuViewController
property to leftMenuViewController
showMenu:
method calls to showLeftMenu:
switchMenu:
method calls to switchLeftMenu: