diff --git a/SlideMenu/Helper Classes/HomeViewController.m b/SlideMenu/Helper Classes/HomeViewController.m index 70eaf52..46d7fa7 100644 --- a/SlideMenu/Helper Classes/HomeViewController.m +++ b/SlideMenu/Helper Classes/HomeViewController.m @@ -17,12 +17,12 @@ #pragma mark - SlideNavigationController Methods - -- (BOOL)slideNavigationControllerShouldSisplayLeftMenu +- (BOOL)slideNavigationControllerShouldDisplayLeftMenu { return YES; } -- (BOOL)slideNavigationControllerShouldSisplayRightMenu +- (BOOL)slideNavigationControllerShouldDisplayRightMenu { return YES; } diff --git a/SlideMenu/Helper Classes/ProfileDetailViewController.m b/SlideMenu/Helper Classes/ProfileDetailViewController.m index 9727042..6f54452 100644 --- a/SlideMenu/Helper Classes/ProfileDetailViewController.m +++ b/SlideMenu/Helper Classes/ProfileDetailViewController.m @@ -17,12 +17,12 @@ #pragma mark - SlideNavigationController Methods - -- (BOOL)slideNavigationControllerShouldSisplayLeftMenu +- (BOOL)slideNavigationControllerShouldDisplayLeftMenu { return NO; } -- (BOOL)slideNavigationControllerShouldSisplayRightMenu +- (BOOL)slideNavigationControllerShouldDisplayRightMenu { return YES; } diff --git a/SlideMenu/Helper Classes/ProfileViewController.m b/SlideMenu/Helper Classes/ProfileViewController.m index 415b9d2..59348d9 100644 --- a/SlideMenu/Helper Classes/ProfileViewController.m +++ b/SlideMenu/Helper Classes/ProfileViewController.m @@ -17,12 +17,12 @@ #pragma mark - SlideNavigationController Methods - -- (BOOL)slideNavigationControllerShouldSisplayLeftMenu +- (BOOL)slideNavigationControllerShouldDisplayLeftMenu { return YES; } -- (BOOL)slideNavigationControllerShouldSisplayRightMenu +- (BOOL)slideNavigationControllerShouldDisplayRightMenu { return YES; } diff --git a/SlideMenu/Source/SlideNavigationController.h b/SlideMenu/Source/SlideNavigationController.h index ef8db6a..c912360 100644 --- a/SlideMenu/Source/SlideNavigationController.h +++ b/SlideMenu/Source/SlideNavigationController.h @@ -11,8 +11,8 @@ @protocol SlideNavigationControllerDelegate @optional -- (BOOL)slideNavigationControllerShouldSisplayRightMenu; -- (BOOL)slideNavigationControllerShouldSisplayLeftMenu; +- (BOOL)slideNavigationControllerShouldDisplayRightMenu; +- (BOOL)slideNavigationControllerShouldDisplayLeftMenu; @end typedef enum{ diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index 078ea4c..5b5c7af 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -100,8 +100,8 @@ static SlideNavigationController *singletonInstance; self.view.frame = rect; } completion:^(BOOL finished) { - [self popToRootViewControllerAnimated:NO]; - [self pushViewController:viewController animated:NO]; + [super popToRootViewControllerAnimated:NO]; + [super pushViewController:viewController animated:NO]; [self closeMenuWithCompletion:^{ if (completion) @@ -111,14 +111,60 @@ static SlideNavigationController *singletonInstance; } else { - [self popToRootViewControllerAnimated:NO]; - [self pushViewController:viewController animated:YES]; + [super popToRootViewControllerAnimated:NO]; + [super pushViewController:viewController animated:YES]; if (completion) completion(); } } +- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated +{ + if ([self isMenuOpen]) + { + [self closeMenuWithCompletion:^{ + [super popToRootViewControllerAnimated:animated]; + }]; + } + else + { + return [super popToRootViewControllerAnimated:animated]; + } + + return nil; +} + +- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated +{ + if ([self isMenuOpen]) + { + [self closeMenuWithCompletion:^{ + [super pushViewController:viewController animated:animated]; + }]; + } + else + { + [super pushViewController:viewController animated:animated]; + } +} + +- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated +{ + if ([self isMenuOpen]) + { + [self closeMenuWithCompletion:^{ + [super popToViewController:viewController animated:animated]; + }]; + } + else + { + return [super popToViewController:viewController animated:animated]; + } + + return nil; +} + #pragma mark - Private Methods - - (UIBarButtonItem *)barButtonItemForMenu:(Menu)menu @@ -148,16 +194,16 @@ static SlideNavigationController *singletonInstance; { if (menu == MenuRight) { - if ([vc respondsToSelector:@selector(slideNavigationControllerShouldSisplayRightMenu)] && - [(UIViewController *)vc slideNavigationControllerShouldSisplayRightMenu]) + if ([vc respondsToSelector:@selector(slideNavigationControllerShouldDisplayRightMenu)] && + [(UIViewController *)vc slideNavigationControllerShouldDisplayRightMenu]) { return YES; } } if (menu == MenuLeft) { - if ([vc respondsToSelector:@selector(slideNavigationControllerShouldSisplayLeftMenu)] && - [(UIViewController *)vc slideNavigationControllerShouldSisplayLeftMenu]) + if ([vc respondsToSelector:@selector(slideNavigationControllerShouldDisplayLeftMenu)] && + [(UIViewController *)vc slideNavigationControllerShouldDisplayLeftMenu]) { return YES; }