diff --git a/MMDrawerController/MMDrawerController.m b/MMDrawerController/MMDrawerController.m index 06dea4c0..52d79f61 100644 --- a/MMDrawerController/MMDrawerController.m +++ b/MMDrawerController/MMDrawerController.m @@ -762,8 +762,7 @@ -(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrien [self resetDrawerVisualStateForDrawerSide:self.openSide]; } } - if ([self needsManualForwardingOfRotationEvents]) - { + if ([self needsManualForwardingOfRotationEvents]){ for(UIViewController * childViewController in self.childViewControllers){ [childViewController willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; } @@ -794,8 +793,7 @@ -(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInter } } - if ([self needsManualForwardingOfRotationEvents]) - { + if ([self needsManualForwardingOfRotationEvents]){ for(UIViewController * childViewController in self.childViewControllers){ [childViewController willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration]; } @@ -808,10 +806,7 @@ -(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfac -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; - self.startingPanRect = self.centerContainerView.frame; // - - if ([self needsManualForwardingOfRotationEvents]) - { + if ([self needsManualForwardingOfRotationEvents]){ for(UIViewController * childViewController in self.childViewControllers){ [childViewController didRotateFromInterfaceOrientation:fromInterfaceOrientation]; } @@ -1138,6 +1133,12 @@ -(void)setNeedsStatusBarAppearanceUpdateIfSupported{ } } +#pragma mark - iOS 8 Rotation Helpers +- (BOOL)needsManualForwardingOfRotationEvents{ + BOOL isIOS8 = (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_7_1); + return !isIOS8; +} + #pragma mark - Animation helpers -(void)finishAnimationForPanGestureWithXVelocity:(CGFloat)xVelocity completion:(void(^)(BOOL finished))completion{ CGFloat currentOriginX = CGRectGetMinX(self.centerContainerView.frame); @@ -1366,12 +1367,6 @@ -(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveT } } -- (BOOL)needsManualForwardingOfRotationEvents -{ - BOOL beforeIOS8 = ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending); - return beforeIOS8; -} - #pragma mark Gesture Recogizner Delegate Helpers -(MMCloseDrawerGestureMode)possibleCloseGestureModesForGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer withTouch:(UITouch*)touch{ CGPoint point = [touch locationInView:self.childControllerContainerView];