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

Fixing issue where appearance methods were correctly handled for center view controller #212

Merged
merged 1 commit 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
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