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

Two childControllerContainerView's are initialized #152

Merged
merged 1 commit into from
Jan 28, 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
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