@@ -155,15 +155,15 @@ - (void)setMenuViewController:(UIViewController *)menuViewController forDirectio
155155 // Add the new one
156156 [self .menuViewControllers setObject: menuViewController forKey: @(direction)];
157157 if (direction == LMSideBarControllerDirectionLeft) {
158- [self setupViewController: menuViewController frame: CGRectMake (-self .view.bounds.size.width,
158+ [self setupViewController: menuViewController frame: CGRectMake (-menuViewController .view.bounds.size.width,
159159 0 ,
160- self .view.bounds.size.width,
160+ menuViewController .view.bounds.size.width,
161161 self .view.bounds.size.height)];
162162 }
163163 else {
164164 [self setupViewController: menuViewController frame: CGRectMake (self .view.bounds.size.width,
165165 0 ,
166- self .view.bounds.size.width,
166+ menuViewController .view.bounds.size.width,
167167 self .view.bounds.size.height)];
168168 }
169169 menuViewController.view .hidden = YES ;
@@ -323,6 +323,12 @@ - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
323323{
324324 if ([gestureRecognizer isEqual: self .panGestureRecognizer])
325325 {
326+ LMSideBarStyle *style = [self styleForDirection: _currentDirection];
327+ BOOL shouldHandle = [style panGestureRecognizerShouldBegin: gestureRecognizer];
328+ if (!shouldHandle) {
329+ return NO ;
330+ }
331+
326332 CGPoint velocity = [(UIPanGestureRecognizer *)gestureRecognizer velocityInView: gestureRecognizer.view];
327333 BOOL horizontalPan = fabs (velocity.x ) > fabs (velocity.y );
328334
@@ -425,40 +431,30 @@ - (BOOL)shouldAutorotate
425431 return NO ;
426432}
427433
428- - (void )willAnimateRotationToInterfaceOrientation : (UIInterfaceOrientation) toInterfaceOrientation duration : ( NSTimeInterval ) duration
434+ - (void )viewWillTransitionToSize : (CGSize) size withTransitionCoordinator : ( id <UIViewControllerTransitionCoordinator>) coordinator
429435{
430- [super willAnimateRotationToInterfaceOrientation: toInterfaceOrientation duration: duration ];
436+ [super viewWillTransitionToSize: size withTransitionCoordinator: coordinator ];
431437
432438 // Update menu view frame
433439 UIViewController *leftMenuViewController = [self menuViewControllerForDirection: LMSideBarControllerDirectionLeft];
434440 if (leftMenuViewController) {
435- leftMenuViewController.view .frame = CGRectMake (-self .view .bounds .size .width ,
441+ leftMenuViewController.view .frame = CGRectMake (-leftMenuViewController .view .bounds .size .width ,
436442 0 ,
437- self .view .bounds .size .width ,
443+ leftMenuViewController .view .bounds .size .width ,
438444 self.view .bounds .size .height );
439445 }
440446
441447 UIViewController *rightMenuViewController = [self menuViewControllerForDirection: LMSideBarControllerDirectionRight];
442448 if (rightMenuViewController) {
443449 rightMenuViewController.view .frame = CGRectMake (self.view .bounds .size .width ,
444450 0 ,
445- self .view .bounds .size .width ,
451+ rightMenuViewController .view .bounds .size .width ,
446452 self.view .bounds .size .height );
447453 }
448454
449455 // Let current side bar style to handle rotation
450456 if (_currentStyle) {
451- [_currentStyle willAnimateRotationToInterfaceOrientation: toInterfaceOrientation duration: duration];
452- }
453- }
454-
455- - (void )didRotateFromInterfaceOrientation : (UIInterfaceOrientation)fromInterfaceOrientation
456- {
457- [super didRotateFromInterfaceOrientation: fromInterfaceOrientation];
458-
459- // Let current side bar style to handle rotation
460- if (_currentStyle) {
461- [_currentStyle didRotateFromInterfaceOrientation: fromInterfaceOrientation];
457+ [_currentStyle viewWillTransitionToSize: size withTransitionCoordinator: coordinator];
462458 }
463459}
464460
0 commit comments