Skip to content

Commit

Permalink
Merge pull request #152 from mutualmobile/bugfix_152
Browse files Browse the repository at this point in the history
Two childControllerContainerView's are initialized
  • Loading branch information
kcharwood committed Jan 28, 2014
2 parents b12cedf + df8f2d1 commit fa2fd52
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -874,10 +874,20 @@ -(CGFloat)visibleRightDrawerWidth{

-(UIView*)childControllerContainerView{
if(_childControllerContainerView == nil){
_childControllerContainerView = [[UIView alloc] initWithFrame:self.view.bounds];
[_childControllerContainerView setBackgroundColor:[UIColor clearColor]];
[_childControllerContainerView setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
[self.view addSubview:_childControllerContainerView];
//Issue #152 (https://github.com/mutualmobile/MMDrawerController/issues/152)
//Turns out we have two child container views getting added to the view during init,
//because the first request self.view.bounds was kicking off a viewDidLoad, which
//caused us to be able to fall through this check twice.
//
//The fix is to grab the bounds, and then check again that the child container view has
//not been created.
CGRect childContainerViewFrame = self.view.bounds;
if(_childControllerContainerView == nil){
_childControllerContainerView = [[UIView alloc] initWithFrame:childContainerViewFrame];
[_childControllerContainerView setBackgroundColor:[UIColor clearColor]];
[_childControllerContainerView setAutoresizingMask:UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth];
[self.view addSubview:_childControllerContainerView];

}
return _childControllerContainerView;
}
Expand Down

0 comments on commit fa2fd52

Please sign in to comment.