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

Quickfix of strange issue where left drawer gets blank #170

Closed
Closed
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
13 changes: 13 additions & 0 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,19 @@ -(void)openDrawerSide:(MMDrawerSide)drawerSide animated:(BOOL)animated velocity:
[self setAnimatingDrawer:animated];
UIViewController * sideDrawerViewController = [self sideDrawerViewControllerForSide:drawerSide];
CGRect visibleRect = CGRectIntersection(self.childControllerContainerView.bounds,sideDrawerViewController.view.frame);

// Quickfix of strange issue where left drawer gets blank
// https://github.com/mutualmobile/MMDrawerController/issues/30
// For some reason self.centerContainerView.frame.origin.x is sometimes being set to 0.5
// at the end of close animation. This causes drawerFullyCovered to be incorrectly set to false.
// Note: This is just a quickfix. The actual reason of why origin.x is being set to 0.5 in
// the first place should be investigated and corrected in a future version.
CGRect centerContainerViewFrame = self.centerContainerView.frame;
if (centerContainerViewFrame.origin.x == 0.5) {
centerContainerViewFrame.origin.x = 0;
self.centerContainerView.frame = centerContainerViewFrame;
}

BOOL drawerFullyCovered = (CGRectContainsRect(self.centerContainerView.frame, visibleRect) ||
CGRectIsNull(visibleRect));
if(drawerFullyCovered){
Expand Down