From 25e35c57420ade59613bd7a450add3862f56bb79 Mon Sep 17 00:00:00 2001 From: Aryan Ghassemi Date: Sun, 2 Feb 2014 12:05:37 -0800 Subject: [PATCH] - Simplify code - Make sure that user interaction is enable again after device rotates (while menu is open) --- SlideMenu/Source/SlideNavigationController.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index a7be305..6f21dad 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -107,6 +107,10 @@ static SlideNavigationController *singletonInstance; { [super viewWillLayoutSubviews]; + // When menu open we disable user interaction + // When rotates we want to make sure that userInteraction is enabled again + self.topViewController.view.userInteractionEnabled = YES; + // Update shadow size self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath; } @@ -309,7 +313,7 @@ static SlideNavigationController *singletonInstance; - (void)openMenu:(Menu)menu withDuration:(float)duration andCompletion:(void (^)())completion { self.topViewController.view.userInteractionEnabled = NO; - [self.topViewController.navigationController.view addGestureRecognizer:self.tapRecognizer]; + [self.view addGestureRecognizer:self.tapRecognizer]; [self prepareMenuForReveal:menu forcePrepare:NO]; @@ -331,7 +335,7 @@ static SlideNavigationController *singletonInstance; - (void)closeMenuWithDuration:(float)duration andCompletion:(void (^)())completion { self.topViewController.view.userInteractionEnabled = YES; - [self.topViewController.navigationController.view removeGestureRecognizer:self.tapRecognizer]; + [self.view removeGestureRecognizer:self.tapRecognizer]; [UIView animateWithDuration:duration delay:0