Skip to content

Commit

Permalink
Merge pull request mutualmobile#271 from pronebird/appearance-patch
Browse files Browse the repository at this point in the history
Do not forward appearance events to central VC when drawer is offscreen
  • Loading branch information
kcharwood committed Aug 25, 2014
2 parents dc091c5 + 86cf110 commit fa2f7bc
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ - (void)decodeRestorableStateWithCoder:(NSCoder *)coder{
[super decodeRestorableStateWithCoder:coder];

if ((controller = [coder decodeObjectForKey:MMDrawerLeftDrawerKey])){
self.leftDrawerViewController = [coder decodeObjectForKey:MMDrawerLeftDrawerKey];
self.leftDrawerViewController = controller;
}

if ((controller = [coder decodeObjectForKey:MMDrawerRightDrawerKey])){
Expand Down Expand Up @@ -426,8 +426,11 @@ -(void)setCenterViewController:(UIViewController *)centerViewController animated
[self updateShadowForCenterView];

if(animated == NO){
[self.centerViewController beginAppearanceTransition:YES animated:NO];
[self.centerViewController endAppearanceTransition];
// If drawer is offscreen, then viewWillAppear: will take care of this
if(self.view.window) {
[self.centerViewController beginAppearanceTransition:YES animated:NO];
[self.centerViewController endAppearanceTransition];
}
[self.centerViewController didMoveToParentViewController:self];
}
}
Expand Down Expand Up @@ -803,6 +806,11 @@ - (void)setDrawerViewController:(UIViewController *)viewController forSide:(MMDr
NSParameterAssert(drawerSide != MMDrawerSideNone);

UIViewController *currentSideViewController = [self sideDrawerViewControllerForSide:drawerSide];

if (currentSideViewController == viewController) {
return;
}

if (currentSideViewController != nil) {
[currentSideViewController beginAppearanceTransition:NO animated:NO];
[currentSideViewController.view removeFromSuperview];
Expand Down

0 comments on commit fa2f7bc

Please sign in to comment.