Skip to content

Commit

Permalink
Merge pull request #70 from mutualmobile/mm_drawerController_Parent_I…
Browse files Browse the repository at this point in the history
…mprovement

Improved Parent DrawerController Detection
  • Loading branch information
kcharwood committed Aug 12, 2013
2 parents 08f720a + eaddcf6 commit 297d7ec
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions MMDrawerController/UIViewController+MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,14 @@ @implementation UIViewController (MMDrawerController)


-(MMDrawerController*)mm_drawerController{
if([self.parentViewController isKindOfClass:[MMDrawerController class]]){
return (MMDrawerController*)self.parentViewController;
}
else if([self.parentViewController isKindOfClass:[UINavigationController class]] &&
[self.parentViewController.parentViewController isKindOfClass:[MMDrawerController class]]){
return (MMDrawerController*)[self.parentViewController parentViewController];
}
else{
return nil;
UIViewController *parentViewController = self.parentViewController;
while (parentViewController != nil) {
if([parentViewController isKindOfClass:[MMDrawerController class]]){
return (MMDrawerController *)parentViewController;
}
parentViewController = parentViewController.parentViewController;
}
return nil;
}

-(CGRect)mm_visibleDrawerFrame{
Expand Down

0 comments on commit 297d7ec

Please sign in to comment.