@@ -48,6 +48,7 @@ @implementation SlideNavigationController
4848NSString *const SlideNavigationControllerDidReveal = @" SlideNavigationControllerDidReveal" ;
4949
5050#define MENU_SLIDE_ANIMATION_DURATION .3
51+ #define MENU_SLIDE_ANIMATION_OPTION UIViewAnimationOptionCurveEaseOut
5152#define MENU_QUICK_SLIDE_ANIMATION_DURATION .18
5253#define MENU_IMAGE @" menu-button"
5354#define MENU_SHADOW_RADIUS 10
@@ -101,13 +102,25 @@ - (id)initWithRootViewController:(UIViewController *)rootViewController
101102 return self;
102103}
103104
105+ - (id )initWithNavigationBarClass : (Class )navigationBarClass toolbarClass : (Class )toolbarClass
106+ {
107+ if (self = [super initWithNavigationBarClass: navigationBarClass toolbarClass: toolbarClass])
108+ {
109+ [self setup ];
110+ }
111+
112+ return self;
113+ }
114+
104115- (void )setup
105116{
106117 if (singletonInstance)
107118 NSLog (@" Singleton instance already exists. You can only instantiate one instance of SlideNavigationController. This could cause major issues" );
108119
109120 singletonInstance = self;
110121
122+ self.menuRevealAnimationDuration = MENU_SLIDE_ANIMATION_DURATION;
123+ self.menuRevealAnimationOption = MENU_SLIDE_ANIMATION_OPTION;
111124 self.landscapeSlideOffset = MENU_DEFAULT_SLIDE_OFFSET;
112125 self.portraitSlideOffset = MENU_DEFAULT_SLIDE_OFFSET;
113126 self.panGestureSideOffset = 0 ;
@@ -232,9 +245,9 @@ - (void)switchToViewController:(UIViewController *)viewController
232245 {
233246 if (slideOutAnimation)
234247 {
235- [UIView animateWithDuration: (slideOutAnimation) ? MENU_SLIDE_ANIMATION_DURATION : 0
248+ [UIView animateWithDuration: (slideOutAnimation) ? self .menuRevealAnimationDuration : 0
236249 delay: 0
237- options: UIViewAnimationOptionCurveEaseOut
250+ options: self .menuRevealAnimationOption
238251 animations: ^{
239252 CGFloat width = self.horizontalSize ;
240253 CGFloat moveLocation = (self.horizontalLocation > 0 ) ? width : -1 *width;
@@ -287,12 +300,12 @@ - (void)popAllAndSwitchToViewController:(UIViewController *)viewController
287300
288301- (void )closeMenuWithCompletion : (void (^)())completion
289302{
290- [self closeMenuWithDuration: MENU_SLIDE_ANIMATION_DURATION andCompletion: completion];
303+ [self closeMenuWithDuration: self .menuRevealAnimationDuration andCompletion: completion];
291304}
292305
293306- (void )openMenu : (Menu)menu withCompletion : (void (^)())completion
294307{
295- [self openMenu: menu withDuration: MENU_SLIDE_ANIMATION_DURATION andCompletion: completion];
308+ [self openMenu: menu withDuration: self .menuRevealAnimationDuration andCompletion: completion];
296309}
297310
298311- (void )toggleLeftMenu
@@ -467,7 +480,7 @@ - (void)openMenu:(Menu)menu withDuration:(float)duration andCompletion:(void (^)
467480
468481 [UIView animateWithDuration: duration
469482 delay: 0
470- options: UIViewAnimationOptionCurveEaseOut
483+ options: self .menuRevealAnimationOption
471484 animations: ^{
472485 CGRect rect = self.view .frame ;
473486 CGFloat width = self.horizontalSize ;
@@ -490,7 +503,7 @@ - (void)closeMenuWithDuration:(float)duration andCompletion:(void (^)())completi
490503
491504 [UIView animateWithDuration: duration
492505 delay: 0
493- options: UIViewAnimationOptionCurveEaseOut
506+ options: self .menuRevealAnimationOption
494507 animations: ^{
495508 CGRect rect = self.view .frame ;
496509 rect.origin .x = 0 ;
@@ -647,6 +660,13 @@ - (void)postNotificationWithName:(NSString *)name forMenu:(Menu)menu
647660 [[NSNotificationCenter defaultCenter ] postNotificationName: name object: nil userInfo: userInfo];
648661}
649662
663+ #pragma mark - UIGestureRecognizerDelegate Methods -
664+
665+ - (BOOL )gestureRecognizer : (UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer : (UIGestureRecognizer *)otherGestureRecognizer
666+ {
667+ return YES ;
668+ }
669+
650670#pragma mark - UINavigationControllerDelegate Methods -
651671
652672- (void )navigationController : (UINavigationController *)navigationController
0 commit comments