diff --git a/README.md b/README.md index 0fcb091..dbf6452 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -iOS-Slide-Menu [![Version](http://cocoapod-badges.herokuapp.com/v/iOS-Slide-Menu/badge.png)](http://cocoadocs.org/docsets/iOS-Slide-Menu) +iOS-Slide-Menu --------- - iOS Slide Menu built on top of UINavigationController, with configurable buttons, reveal animations, and tap/swiper gesture recognizers. - [Setup](https://github.com/aryaxt/iOS-Slide-Menu#setup) @@ -12,10 +11,6 @@ iOS Slide Menu built on top of UINavigationController, with configurable buttons ![alt tag](https://raw.github.com/aryaxt/iOS-Slide-Menu/master/slideMenuAnimation.gif) -Version 1.4.5 Notes ---------- -Enabling shouldRecognizeSimultaneouslyWithGestureRecognizer was causing issues, if you are seeing unexpected gesture behavior delete the pod and reinstall as that method has been removed - Version 1.4.0 Notes --------- ```switchToViewController:withCompletion:``` method has been deprecated. In order to get the exact same behavior use ```popToRootAndSwitchToViewController:withCompletion``` diff --git a/SlideMenu/AppDelegate.m b/SlideMenu/AppDelegate.m index 8e84687..7633851 100644 --- a/SlideMenu/AppDelegate.m +++ b/SlideMenu/AppDelegate.m @@ -42,6 +42,11 @@ NSLog(@"Opened %@", menu); }]; + [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerWillOpen object:nil queue:nil usingBlock:^(NSNotification *note) { + NSString *menu = note.userInfo[@"menu"]; + NSLog(@"Opening %@", menu); + }]; + [[NSNotificationCenter defaultCenter] addObserverForName:SlideNavigationControllerDidReveal object:nil queue:nil usingBlock:^(NSNotification *note) { NSString *menu = note.userInfo[@"menu"]; NSLog(@"Revealed %@", menu); diff --git a/SlideMenu/Source/Animations/SlideNavigationContorllerAnimatorSlide.m b/SlideMenu/Source/Animations/SlideNavigationContorllerAnimatorSlide.m index c694520..9e2c0c3 100644 --- a/SlideMenu/Source/Animations/SlideNavigationContorllerAnimatorSlide.m +++ b/SlideMenu/Source/Animations/SlideNavigationContorllerAnimatorSlide.m @@ -58,7 +58,7 @@ ? [SlideNavigationController sharedInstance].leftMenu : [SlideNavigationController sharedInstance].rightMenu; - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; + UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance].interfaceOrientation; CGRect rect = menuViewController.view.frame; if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) @@ -67,9 +67,9 @@ } else { - if (UIDeviceOrientationIsLandscape(orientation)) + if (UIInterfaceOrientationIsLandscape(orientation)) { - if (orientation == UIDeviceOrientationLandscapeRight) + if (orientation == UIInterfaceOrientationLandscapeRight) { rect.origin.y = (menu == MenuLeft) ? self.slideMovement*-1 : self.slideMovement; } @@ -80,7 +80,7 @@ } else { - if (orientation == UIDeviceOrientationPortrait) + if (orientation == UIInterfaceOrientationPortrait) { rect.origin.x = (menu == MenuLeft) ? self.slideMovement*-1 : self.slideMovement; } @@ -100,7 +100,7 @@ ? [SlideNavigationController sharedInstance].leftMenu : [SlideNavigationController sharedInstance].rightMenu; - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; + UIInterfaceOrientation orientation = [SlideNavigationController sharedInstance].interfaceOrientation; NSInteger location = (menu == MenuLeft) ? (self.slideMovement * -1) + (self.slideMovement * progress) @@ -120,13 +120,13 @@ } else { - if (UIDeviceOrientationIsLandscape(orientation)) + if (UIInterfaceOrientationIsLandscape(orientation)) { - rect.origin.y = (orientation == UIDeviceOrientationLandscapeRight) ? location : location*-1; + rect.origin.y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1; } else { - rect.origin.x = (orientation == UIDeviceOrientationPortrait) ? location : location*-1; + rect.origin.x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1; } } @@ -147,8 +147,8 @@ ? [SlideNavigationController sharedInstance].leftMenu : [SlideNavigationController sharedInstance].rightMenu; - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; - + UIInterfaceOrientation orientation= [SlideNavigationController sharedInstance].interfaceOrientation; + CGRect rect = menuViewController.view.frame; if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) @@ -157,7 +157,7 @@ } else { - if (UIDeviceOrientationIsLandscape(orientation)) + if (UIInterfaceOrientationIsLandscape(orientation)) { rect.origin.y = 0; } diff --git a/SlideMenu/Source/SlideNavigationController.h b/SlideMenu/Source/SlideNavigationController.h index b64701b..feefa80 100644 --- a/SlideMenu/Source/SlideNavigationController.h +++ b/SlideMenu/Source/SlideNavigationController.h @@ -75,4 +75,6 @@ extern NSString *const SlideNavigationControllerDidReveal; - (void)toggleRightMenu; - (BOOL)isMenuOpen; +- (void)prepareMenuForReveal:(Menu)menu; + @end diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index 2efcdba..2785286 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -520,7 +520,7 @@ static SlideNavigationController *singletonInstance; - (void)moveHorizontallyToLocation:(CGFloat)location { CGRect rect = self.view.frame; - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; + UIInterfaceOrientation orientation = self.interfaceOrientation; Menu menu = (self.horizontalLocation >= 0 && location >= 0) ? MenuLeft : MenuRight; if ((location > 0 && self.horizontalLocation <= 0) || (location < 0 && self.horizontalLocation >= 0)) { @@ -534,14 +534,14 @@ static SlideNavigationController *singletonInstance; } else { - if (UIDeviceOrientationIsLandscape(orientation)) + if (UIInterfaceOrientationIsLandscape(orientation)) { rect.origin.x = 0; - rect.origin.y = (orientation == UIDeviceOrientationLandscapeRight) ? location : location*-1; + rect.origin.y = (orientation == UIInterfaceOrientationLandscapeRight) ? location : location*-1; } else { - rect.origin.x = (orientation == UIDeviceOrientationPortrait) ? location : location*-1; + rect.origin.x = (orientation == UIInterfaceOrientationPortrait) ? location : location*-1; rect.origin.y = 0; } } @@ -570,18 +570,16 @@ static SlideNavigationController *singletonInstance; return rect; } - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; - - if (UIDeviceOrientationIsLandscape(orientation)) + if (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) { // For some reasons in landscape below the status bar is considered y=0, but in portrait it's considered y=20 - rect.origin.x = (orientation == UIDeviceOrientationLandscapeRight) ? 0 : STATUS_BAR_HEIGHT; + rect.origin.x = (self.interfaceOrientation == UIInterfaceOrientationLandscapeRight) ? 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 = (orientation == UIDeviceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0; + rect.origin.y = (self.interfaceOrientation == UIInterfaceOrientationPortrait) ? STATUS_BAR_HEIGHT : 0; rect.size.height = self.view.frame.size.height-STATUS_BAR_HEIGHT; } @@ -610,7 +608,7 @@ static SlideNavigationController *singletonInstance; - (CGFloat)horizontalLocation { CGRect rect = self.view.frame; - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; + UIInterfaceOrientation orientation = self.interfaceOrientation; if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) { @@ -618,15 +616,15 @@ static SlideNavigationController *singletonInstance; } else { - if (UIDeviceOrientationIsLandscape(orientation)) + if (UIInterfaceOrientationIsLandscape(orientation)) { - return (orientation == UIDeviceOrientationLandscapeRight) + return (orientation == UIInterfaceOrientationLandscapeRight) ? rect.origin.y : rect.origin.y*-1; } else { - return (orientation == UIDeviceOrientationPortrait) + return (orientation == UIInterfaceOrientationPortrait) ? rect.origin.x : rect.origin.x*-1; } @@ -636,7 +634,7 @@ static SlideNavigationController *singletonInstance; - (CGFloat)horizontalSize { CGRect rect = self.view.frame; - UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; + UIInterfaceOrientation orientation = self.interfaceOrientation; if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) { @@ -644,7 +642,7 @@ static SlideNavigationController *singletonInstance; } else { - if (UIDeviceOrientationIsLandscape(orientation)) + if (UIInterfaceOrientationIsLandscape(orientation)) { return rect.size.height; } @@ -677,7 +675,7 @@ static SlideNavigationController *singletonInstance; - (CGFloat)slideOffset { - return (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation)) + return (UIInterfaceOrientationIsLandscape(self.interfaceOrientation)) ? self.landscapeSlideOffset : self.portraitSlideOffset; }