Skip to content

Commit

Permalink
Fixing #222 #204 for rotation problems
Browse files Browse the repository at this point in the history
  • Loading branch information
kcharwood committed Jun 9, 2014
1 parent 9177b94 commit 38e9c2d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -736,12 +736,15 @@ -(void)viewDidDisappear:(BOOL)animated{
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
//If a rotation begins, we are going to cancel the current gesture and reset transform and anchor points so everything works correctly
for(UIGestureRecognizer * gesture in self.childControllerContainerView.gestureRecognizers){
BOOL gestureInProgress = NO;
for(UIGestureRecognizer * gesture in self.view.gestureRecognizers){
if(gesture.state == UIGestureRecognizerStateChanged){
[gesture setEnabled:NO];
[gesture setEnabled:YES];
gestureInProgress = YES;
}
if (gestureInProgress) {
[self resetDrawerVisualStateForDrawerSide:self.openSide];
break;
}
}
for(UIViewController * childViewController in self.childViewControllers){
Expand Down Expand Up @@ -1044,7 +1047,8 @@ -(void)panGestureCallback:(UIPanGestureRecognizer *)panGesture{
[self.centerContainerView setCenter:CGPointMake(CGRectGetMidX(newFrame), CGRectGetMidY(newFrame))];
break;
}
case UIGestureRecognizerStateEnded:{
case UIGestureRecognizerStateEnded:
case UIGestureRecognizerStateCancelled: {
self.startingPanRect = CGRectNull;
CGPoint velocity = [panGesture velocityInView:self.childControllerContainerView];
[self finishAnimationForPanGestureWithXVelocity:velocity.x completion:^(BOOL finished) {
Expand All @@ -1055,11 +1059,6 @@ -(void)panGestureCallback:(UIPanGestureRecognizer *)panGesture{
self.view.userInteractionEnabled = YES;
break;
}
case UIGestureRecognizerStateCancelled:{
[panGesture setEnabled:YES];
self.view.userInteractionEnabled = YES;
break;
}
default:
break;
}
Expand Down

0 comments on commit 38e9c2d

Please sign in to comment.