|
|
|
|
@ -47,12 +47,8 @@ NSString * const SlideNavigationControllerDidOpen = @"SlideNavigationControllerD
|
|
|
|
|
NSString * const SlideNavigationControllerDidClose = @"SlideNavigationControllerDidClose";
|
|
|
|
|
NSString *const SlideNavigationControllerDidReveal = @"SlideNavigationControllerDidReveal";
|
|
|
|
|
|
|
|
|
|
NSString *const SlideMenuOpenAfterSwipeKey = @"SlideMenuOpenAfterSwipeKey";
|
|
|
|
|
|
|
|
|
|
#define MENU_SLIDE_ANIMATION_DURATION .3
|
|
|
|
|
#define MENU_SLIDE_OPEN_ANIMATION_DURATION .4
|
|
|
|
|
#define MENU_SLIDE_CLOSE_ANIMATION_DURATION .2
|
|
|
|
|
#define MENU_SLIDE_ANIMATION_OPTION UIViewAnimationOptionCurveLinear
|
|
|
|
|
#define MENU_SLIDE_ANIMATION_OPTION UIViewAnimationOptionCurveEaseOut
|
|
|
|
|
#define MENU_QUICK_SLIDE_ANIMATION_DURATION .18
|
|
|
|
|
#define MENU_IMAGE @"menu-button"
|
|
|
|
|
#define MENU_SHADOW_RADIUS 10
|
|
|
|
|
@ -123,8 +119,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
|
|
|
|
|
singletonInstance = self;
|
|
|
|
|
|
|
|
|
|
self.menuOpenAnimationDuration = MENU_SLIDE_OPEN_ANIMATION_DURATION;
|
|
|
|
|
self.menuCloseAnimationDuration = MENU_SLIDE_CLOSE_ANIMATION_DURATION;
|
|
|
|
|
self.menuRevealAnimationDuration = MENU_SLIDE_ANIMATION_DURATION;
|
|
|
|
|
self.menuRevealAnimationOption = MENU_SLIDE_ANIMATION_OPTION;
|
|
|
|
|
self.landscapeSlideOffset = MENU_DEFAULT_SLIDE_OFFSET;
|
|
|
|
|
self.portraitSlideOffset = MENU_DEFAULT_SLIDE_OFFSET;
|
|
|
|
|
@ -145,7 +140,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
|
|
|
|
|
// When menu open we disable user interaction
|
|
|
|
|
// When rotates we want to make sure that userInteraction is enabled again
|
|
|
|
|
//[self enableTapGestureToCloseMenu:NO];
|
|
|
|
|
[self enableTapGestureToCloseMenu:NO];
|
|
|
|
|
|
|
|
|
|
if (self.menuNeedsLayout)
|
|
|
|
|
{
|
|
|
|
|
@ -156,7 +151,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0") && [self isMenuOpen])
|
|
|
|
|
{
|
|
|
|
|
Menu menu = (self.horizontalLocation > 0) ? MenuLeft : MenuRight;
|
|
|
|
|
[self openMenu:menu withCompletion:nil];
|
|
|
|
|
[self openMenu:menu withDuration:0 andCompletion:nil];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.menuNeedsLayout = NO;
|
|
|
|
|
@ -213,7 +208,8 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)switchToViewController:(UIViewController *)viewController
|
|
|
|
|
popType:(PopType)poptype
|
|
|
|
|
withSlideOutAnimation:(BOOL)slideOutAnimation
|
|
|
|
|
popType:(PopType)poptype
|
|
|
|
|
andCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
if (self.avoidSwitchingToSameClassViewController && [self.topViewController isKindOfClass:viewController.class])
|
|
|
|
|
@ -221,87 +217,95 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
[self closeMenuWithCompletion:completion];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void (^switchAndCallCompletion)(BOOL) = ^(BOOL closeMenuBeforeCallingCompletion) {
|
|
|
|
|
if (poptype == PopTypeAll) {
|
|
|
|
|
[self setViewControllers:@[viewController]];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
[super popToRootViewControllerAnimated:NO];
|
|
|
|
|
[super pushViewController:viewController animated:NO];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (closeMenuBeforeCallingCompletion)
|
|
|
|
|
{
|
|
|
|
|
[self closeMenuWithCompletion:^{
|
|
|
|
|
if (completion)
|
|
|
|
|
completion();
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (completion)
|
|
|
|
|
completion();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// if ([self isMenuOpen])
|
|
|
|
|
// {
|
|
|
|
|
// if (slideOutAnimation)
|
|
|
|
|
// {
|
|
|
|
|
// [UIView animateWithDuration:(slideOutAnimation) ? self.menuRevealAnimationDuration : 0
|
|
|
|
|
// delay:0
|
|
|
|
|
// options:self.menuRevealAnimationOption
|
|
|
|
|
// animations:^{
|
|
|
|
|
// CGFloat width = self.horizontalSize;
|
|
|
|
|
// CGFloat moveLocation = (self.horizontalLocation> 0) ? width : -1*width;
|
|
|
|
|
// [self moveHorizontallyToLocation:moveLocation];
|
|
|
|
|
// } completion:^(BOOL finished) {
|
|
|
|
|
// switchAndCallCompletion(YES);
|
|
|
|
|
// }];
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// switchAndCallCompletion(YES);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// switchAndCallCompletion(NO);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
switchAndCallCompletion([self isMenuOpen]);
|
|
|
|
|
|
|
|
|
|
void (^switchAndCallCompletion)(BOOL) = ^(BOOL closeMenuBeforeCallingCompletion) {
|
|
|
|
|
if (poptype == PopTypeAll) {
|
|
|
|
|
[self setViewControllers:@[viewController]];
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
[super popToRootViewControllerAnimated:NO];
|
|
|
|
|
[super pushViewController:viewController animated:NO];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (closeMenuBeforeCallingCompletion)
|
|
|
|
|
{
|
|
|
|
|
[self closeMenuWithCompletion:^{
|
|
|
|
|
if (completion)
|
|
|
|
|
completion();
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (completion)
|
|
|
|
|
completion();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if ([self isMenuOpen])
|
|
|
|
|
{
|
|
|
|
|
if (slideOutAnimation)
|
|
|
|
|
{
|
|
|
|
|
[UIView animateWithDuration:(slideOutAnimation) ? self.menuRevealAnimationDuration : 0
|
|
|
|
|
delay:0
|
|
|
|
|
options:self.menuRevealAnimationOption
|
|
|
|
|
animations:^{
|
|
|
|
|
CGFloat width = self.horizontalSize;
|
|
|
|
|
CGFloat moveLocation = (self.horizontalLocation> 0) ? width : -1*width;
|
|
|
|
|
[self moveHorizontallyToLocation:moveLocation];
|
|
|
|
|
} completion:^(BOOL finished) {
|
|
|
|
|
switchAndCallCompletion(YES);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switchAndCallCompletion(YES);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
switchAndCallCompletion(NO);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)switchToViewController:(UIViewController *)viewController withCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self switchToViewController:viewController popType:PopTypeRoot andCompletion:completion];
|
|
|
|
|
[self switchToViewController:viewController withSlideOutAnimation:YES popType:PopTypeRoot andCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)popToRootAndSwitchToViewController:(UIViewController *)viewController
|
|
|
|
|
withSlideOutAnimation:(BOOL)slideOutAnimation
|
|
|
|
|
andCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self switchToViewController:viewController popType:PopTypeRoot andCompletion:completion];
|
|
|
|
|
[self switchToViewController:viewController withSlideOutAnimation:slideOutAnimation popType:PopTypeRoot andCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)popToRootAndSwitchToViewController:(UIViewController *)viewController
|
|
|
|
|
withCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self switchToViewController:viewController popType:PopTypeRoot andCompletion:completion];
|
|
|
|
|
[self switchToViewController:viewController withSlideOutAnimation:YES popType:PopTypeRoot andCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)popAllAndSwitchToViewController:(UIViewController *)viewController
|
|
|
|
|
withSlideOutAnimation:(BOOL)slideOutAnimation
|
|
|
|
|
andCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self switchToViewController:viewController popType:PopTypeAll andCompletion:completion];
|
|
|
|
|
[self switchToViewController:viewController withSlideOutAnimation:slideOutAnimation popType:PopTypeAll andCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)popAllAndSwitchToViewController:(UIViewController *)viewController
|
|
|
|
|
withCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self switchToViewController:viewController popType:PopTypeAll andCompletion:completion];
|
|
|
|
|
[self switchToViewController:viewController withSlideOutAnimation:YES popType:PopTypeAll andCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)closeMenuWithCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self closeMenuWithDuration:self.menuRevealAnimationDuration andCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)openMenu:(Menu)menu withCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self openMenu:menu withDuration:self.menuRevealAnimationDuration andCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)toggleLeftMenu
|
|
|
|
|
@ -468,23 +472,8 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
return NO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (CGFloat)openingPart
|
|
|
|
|
- (void)openMenu:(Menu)menu withDuration:(float)duration andCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
CGFloat slideOffset = self.slideOffset;
|
|
|
|
|
CGFloat absHorizontalLocation = (CGFloat)fabs(self.horizontalLocation);
|
|
|
|
|
|
|
|
|
|
return MIN(1.f, absHorizontalLocation/slideOffset);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)openMenu:(Menu)menu withCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
[self openMenu:menu afterSwipe:NO withCompletion:completion];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)openMenu:(Menu)menu afterSwipe:(BOOL)afterSwipe withCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
NSTimeInterval duration = self.menuOpenAnimationDuration * (1.f - [self openingPart]);
|
|
|
|
|
|
|
|
|
|
[self enableTapGestureToCloseMenu:YES];
|
|
|
|
|
|
|
|
|
|
[self prepareMenuForReveal:menu];
|
|
|
|
|
@ -502,16 +491,12 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
if (completion)
|
|
|
|
|
completion();
|
|
|
|
|
|
|
|
|
|
[self postNotificationWithName:SlideNavigationControllerDidOpen forMenu:menu withExtParams:@{
|
|
|
|
|
SlideMenuOpenAfterSwipeKey : @(afterSwipe)
|
|
|
|
|
}];
|
|
|
|
|
[self postNotificationWithName:SlideNavigationControllerDidOpen forMenu:menu];
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)closeMenuWithCompletion:(void (^)())completion
|
|
|
|
|
- (void)closeMenuWithDuration:(float)duration andCompletion:(void (^)())completion
|
|
|
|
|
{
|
|
|
|
|
NSTimeInterval duration = self.menuCloseAnimationDuration * [self openingPart];
|
|
|
|
|
|
|
|
|
|
[self enableTapGestureToCloseMenu:NO];
|
|
|
|
|
|
|
|
|
|
Menu menu = (self.horizontalLocation > 0) ? MenuLeft : MenuRight;
|
|
|
|
|
@ -535,7 +520,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
- (void)moveHorizontallyToLocation:(CGFloat)location
|
|
|
|
|
{
|
|
|
|
|
CGRect rect = self.view.frame;
|
|
|
|
|
UIInterfaceOrientation orientation = self.interfaceOrientation;
|
|
|
|
|
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
|
|
|
|
Menu menu = (self.horizontalLocation >= 0 && location >= 0) ? MenuLeft : MenuRight;
|
|
|
|
|
|
|
|
|
|
if ((location > 0 && self.horizontalLocation <= 0) || (location < 0 && self.horizontalLocation >= 0)) {
|
|
|
|
|
@ -549,14 +534,14 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (UIInterfaceOrientationIsLandscape(orientation))
|
|
|
|
|
if (UIDeviceOrientationIsLandscape(orientation))
|
|
|
|
|
{
|
|
|
|
|
rect.origin.x = 0;
|
|
|
|
|
rect.origin.y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1;
|
|
|
|
|
rect.origin.y = (orientation == UIDeviceOrientationLandscapeRight) ? location*-1 : location;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rect.origin.x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1;
|
|
|
|
|
rect.origin.x = (orientation == UIDeviceOrientationPortrait) ? location : location*-1;
|
|
|
|
|
rect.origin.y = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -585,16 +570,18 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
return rect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
|
|
|
|
|
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
|
|
|
|
|
|
|
|
|
if (UIDeviceOrientationIsLandscape(orientation))
|
|
|
|
|
{
|
|
|
|
|
// For some reasons in landscape below the status bar is considered y=0, but in portrait it's considered y=20
|
|
|
|
|
rect.origin.x = (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) ? 0 : STATUS_BAR_HEIGHT;
|
|
|
|
|
rect.origin.x = (orientation == UIDeviceOrientationLandscapeRight) ? 0 : STATUS_BAR_HEIGHT;
|
|
|
|
|
rect.size.width = self.view.frame.size.width-STATUS_BAR_HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// For some reasons in landscape below the status bar is considered y=0, but in portrait it's considered y=20
|
|
|
|
|
rect.origin.y = (self.interfaceOrientation == UIInterfaceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0;
|
|
|
|
|
rect.origin.y = (orientation == UIDeviceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0;
|
|
|
|
|
rect.size.height = self.view.frame.size.height-STATUS_BAR_HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -623,7 +610,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
- (CGFloat)horizontalLocation
|
|
|
|
|
{
|
|
|
|
|
CGRect rect = self.view.frame;
|
|
|
|
|
UIInterfaceOrientation orientation = self.interfaceOrientation;
|
|
|
|
|
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
|
|
|
|
|
|
|
|
|
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
|
|
|
|
|
{
|
|
|
|
|
@ -631,15 +618,15 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (UIInterfaceOrientationIsLandscape(orientation))
|
|
|
|
|
if (UIDeviceOrientationIsLandscape(orientation))
|
|
|
|
|
{
|
|
|
|
|
return (orientation == UIInterfaceOrientationLandscapeRight)
|
|
|
|
|
? rect.origin.y
|
|
|
|
|
: rect.origin.y*-1;
|
|
|
|
|
return (orientation == UIDeviceOrientationLandscapeRight)
|
|
|
|
|
? rect.origin.y*-1
|
|
|
|
|
: rect.origin.y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return (orientation == UIInterfaceOrientationPortrait)
|
|
|
|
|
return (orientation == UIDeviceOrientationPortrait)
|
|
|
|
|
? rect.origin.x
|
|
|
|
|
: rect.origin.x*-1;
|
|
|
|
|
}
|
|
|
|
|
@ -649,7 +636,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
- (CGFloat)horizontalSize
|
|
|
|
|
{
|
|
|
|
|
CGRect rect = self.view.frame;
|
|
|
|
|
UIInterfaceOrientation orientation = self.interfaceOrientation;
|
|
|
|
|
UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
|
|
|
|
|
|
|
|
|
|
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
|
|
|
|
|
{
|
|
|
|
|
@ -657,7 +644,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (UIInterfaceOrientationIsLandscape(orientation))
|
|
|
|
|
if (UIDeviceOrientationIsLandscape(orientation))
|
|
|
|
|
{
|
|
|
|
|
return rect.size.height;
|
|
|
|
|
}
|
|
|
|
|
@ -670,22 +657,27 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
|
|
|
|
|
- (void)postNotificationWithName:(NSString *)name forMenu:(Menu)menu
|
|
|
|
|
{
|
|
|
|
|
[self postNotificationWithName:name forMenu:menu withExtParams:nil];
|
|
|
|
|
NSString *menuString = (menu == MenuLeft) ? NOTIFICATION_USER_INFO_MENU_LEFT : NOTIFICATION_USER_INFO_MENU_RIGHT;
|
|
|
|
|
NSDictionary *userInfo = @{ NOTIFICATION_USER_INFO_MENU : menuString };
|
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:userInfo];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)postNotificationWithName:(NSString *)name forMenu:(Menu)menu withExtParams:(NSDictionary *)extParams
|
|
|
|
|
#pragma mark - UINavigationControllerDelegate Methods -
|
|
|
|
|
|
|
|
|
|
- (void)navigationController:(UINavigationController *)navigationController
|
|
|
|
|
willShowViewController:(UIViewController *)viewController
|
|
|
|
|
animated:(BOOL)animated
|
|
|
|
|
{
|
|
|
|
|
NSMutableDictionary *userInfo = extParams ? [extParams mutableCopy] : [NSMutableDictionary dictionary];
|
|
|
|
|
|
|
|
|
|
NSString *menuString = (menu == MenuLeft) ? NOTIFICATION_USER_INFO_MENU_LEFT : NOTIFICATION_USER_INFO_MENU_RIGHT;
|
|
|
|
|
userInfo[NOTIFICATION_USER_INFO_MENU] = menuString;
|
|
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] postNotificationName:name object:nil userInfo:[userInfo copy]];
|
|
|
|
|
if ([self shouldDisplayMenu:MenuLeft forViewController:viewController])
|
|
|
|
|
viewController.navigationItem.leftBarButtonItem = [self barButtonItemForMenu:MenuLeft];
|
|
|
|
|
|
|
|
|
|
if ([self shouldDisplayMenu:MenuRight forViewController:viewController])
|
|
|
|
|
viewController.navigationItem.rightBarButtonItem = [self barButtonItemForMenu:MenuRight];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (CGFloat)slideOffset
|
|
|
|
|
{
|
|
|
|
|
return (UIInterfaceOrientationIsLandscape(self.interfaceOrientation))
|
|
|
|
|
return (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
|
|
|
|
|
? self.landscapeSlideOffset
|
|
|
|
|
: self.portraitSlideOffset;
|
|
|
|
|
}
|
|
|
|
|
@ -743,8 +735,8 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
else
|
|
|
|
|
currentMenu = (translation.x > 0) ? MenuLeft : MenuRight;
|
|
|
|
|
|
|
|
|
|
// if (![self shouldDisplayMenu:currentMenu forViewController:self.topViewController])
|
|
|
|
|
// return;
|
|
|
|
|
if (![self shouldDisplayMenu:currentMenu forViewController:self.topViewController])
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
[self prepareMenuForReveal:currentMenu];
|
|
|
|
|
|
|
|
|
|
@ -781,11 +773,11 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
if (currentX > 0)
|
|
|
|
|
{
|
|
|
|
|
if ([self shouldDisplayMenu:menu forViewController:self.visibleViewController])
|
|
|
|
|
[self openMenu:(velocity.x > 0) ? MenuLeft : MenuRight afterSwipe:YES withCompletion:nil];
|
|
|
|
|
[self openMenu:(velocity.x > 0) ? MenuLeft : MenuRight withDuration:MENU_QUICK_SLIDE_ANIMATION_DURATION andCompletion:nil];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
[self closeMenuWithCompletion:nil];
|
|
|
|
|
[self closeMenuWithDuration:MENU_QUICK_SLIDE_ANIMATION_DURATION andCompletion:nil];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Moving Left
|
|
|
|
|
@ -793,12 +785,12 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
{
|
|
|
|
|
if (currentX > 0)
|
|
|
|
|
{
|
|
|
|
|
[self closeMenuWithCompletion:nil];
|
|
|
|
|
[self closeMenuWithDuration:MENU_QUICK_SLIDE_ANIMATION_DURATION andCompletion:nil];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if ([self shouldDisplayMenu:menu forViewController:self.visibleViewController])
|
|
|
|
|
[self openMenu:(velocity.x > 0) ? MenuLeft : MenuRight afterSwipe:YES withCompletion:nil];
|
|
|
|
|
[self openMenu:(velocity.x > 0) ? MenuLeft : MenuRight withDuration:MENU_QUICK_SLIDE_ANIMATION_DURATION andCompletion:nil];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -807,7 +799,7 @@ static SlideNavigationController *singletonInstance;
|
|
|
|
|
if (currentXOffset < (self.horizontalSize - self.slideOffset)/2)
|
|
|
|
|
[self closeMenuWithCompletion:nil];
|
|
|
|
|
else
|
|
|
|
|
[self openMenu:(currentX > 0) ? MenuLeft : MenuRight afterSwipe:YES withCompletion:nil];
|
|
|
|
|
[self openMenu:(currentX > 0) ? MenuLeft : MenuRight withCompletion:nil];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|