Skip to content

Commit

Permalink
Merge pull request mutualmobile#212 from mutualmobile/center_view_app…
Browse files Browse the repository at this point in the history
…earance_fix

Mergin' Fixing issue where appearance methods were correctly handled for center view controller
  • Loading branch information
larsacus committed Jan 30, 2014
2 parents 45924c9 + a7ac78b commit 3c95b1c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ -(void)openDrawerSide:(MMDrawerSide)drawerSide animated:(BOOL)animated velocity:
}

#pragma mark - Updating the Center View Controller
//If animated is NO, then we need to handle all the appearance calls within this method. Otherwise,
//let the method calling this one handle proper appearance methods since they will have more context
-(void)setCenterViewController:(UIViewController *)centerViewController animated:(BOOL)animated{
if(_centerContainerView == nil){
_centerContainerView = [[MMDrawerCenterContainerView alloc] initWithFrame:self.childControllerContainerView.bounds];
Expand Down Expand Up @@ -417,9 +419,14 @@ -(void)setCenterViewController:(UIViewController *)centerViewController animated
}

-(void)setCenterViewController:(UIViewController *)newCenterViewController withCloseAnimation:(BOOL)animated completion:(void(^)(BOOL finished))completion{

if(self.openSide == MMDrawerSideNone){
//If a side drawer isn't open, there is nothing to animate...
animated = NO;
}
[self setCenterViewController:newCenterViewController animated:animated];

if(self.openSide != MMDrawerSideNone){
if(animated){
[self updateDrawerVisualStateForDrawerSide:self.openSide percentVisible:1.0];
[self.centerViewController beginAppearanceTransition:YES animated:animated];
[self
Expand All @@ -433,11 +440,8 @@ -(void)setCenterViewController:(UIViewController *)newCenterViewController withC
}];
}
else {
[self.centerViewController beginAppearanceTransition:YES animated:NO];
[self.centerViewController endAppearanceTransition];
[self.centerViewController didMoveToParentViewController:self];
if(completion) {
completion(NO);
completion(YES);
}
}
}
Expand Down

0 comments on commit 3c95b1c

Please sign in to comment.