Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for the black side drawer #211

Merged
merged 2 commits into from
Jan 30, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,8 @@ -(void)setCenterViewController:(UIViewController *)newCenterViewController withF

CGRect newCenterRect = self.centerContainerView.frame;

[self setAnimatingDrawer:animated];

UIViewController * oldCenterViewController = self.centerViewController;
[oldCenterViewController beginAppearanceTransition:NO animated:animated];
newCenterRect.origin.x = targetClosePoint;
Expand Down Expand Up @@ -498,7 +500,7 @@ -(void)setCenterViewController:(UIViewController *)newCenterViewController withF
[sideDrawerViewController.view setFrame:sideDrawerViewController.mm_visibleDrawerFrame];

[self setOpenSide:MMDrawerSideNone];

[self setAnimatingDrawer:NO];
if(completion){
completion(finished);
}
Expand Down Expand Up @@ -914,7 +916,8 @@ -(UIColor*)statusBarViewBackgroundColor{
#pragma mark - Gesture Handlers

-(void)tapGestureCallback:(UITapGestureRecognizer *)tapGesture{
if(self.openSide != MMDrawerSideNone){
if(self.openSide != MMDrawerSideNone &&
self.isAnimatingDrawer == NO){
[self closeDrawerAnimated:YES completion:^(BOOL finished) {
if(self.gestureCompletion){
self.gestureCompletion(self, tapGesture);
Expand All @@ -925,8 +928,15 @@ -(void)tapGestureCallback:(UITapGestureRecognizer *)tapGesture{

-(void)panGestureCallback:(UIPanGestureRecognizer *)panGesture{
switch (panGesture.state) {
case UIGestureRecognizerStateBegan:
self.startingPanRect = self.centerContainerView.frame;
case UIGestureRecognizerStateBegan:{
if(self.animatingDrawer){
[panGesture setEnabled:NO];
break;
}
else {
self.startingPanRect = self.centerContainerView.frame;
}
}
case UIGestureRecognizerStateChanged:{
CGRect newFrame = self.startingPanRect;
CGPoint translatedPoint = [panGesture translationInView:self.centerContainerView];
Expand Down Expand Up @@ -966,7 +976,6 @@ -(void)panGestureCallback:(UIPanGestureRecognizer *)panGesture{
[self.centerContainerView setCenter:CGPointMake(CGRectGetMidX(newFrame), CGRectGetMidY(newFrame))];
break;
}
case UIGestureRecognizerStateCancelled:
case UIGestureRecognizerStateEnded:{
self.startingPanRect = CGRectNull;
CGPoint velocity = [panGesture velocityInView:self.childControllerContainerView];
Expand All @@ -977,6 +986,10 @@ -(void)panGestureCallback:(UIPanGestureRecognizer *)panGesture{
}];
break;
}
case UIGestureRecognizerStateCancelled:{
[panGesture setEnabled:YES];
break;
}
default:
break;
}
Expand Down