From 05a0affa609f7a250750eb29f66f9badf7a86966 Mon Sep 17 00:00:00 2001 From: Craig Isakson Date: Fri, 30 May 2014 07:50:31 -0500 Subject: [PATCH] Update MFSideMenuContainerViewController.m Added code to account for notification bar side as well as a bug I encountered when apps were opened in landscape, you could not view the entire menu due to the frame not being correct if the view that contained the slide-out menu was not the initial view. --- MFSideMenu/MFSideMenuContainerViewController.m | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/MFSideMenu/MFSideMenuContainerViewController.m b/MFSideMenu/MFSideMenuContainerViewController.m index d245ab7..3df1722 100644 --- a/MFSideMenu/MFSideMenuContainerViewController.m +++ b/MFSideMenu/MFSideMenuContainerViewController.m @@ -90,16 +90,26 @@ - (void)setDefaultSettings { - (void)setupMenuContainerView { if(self.menuContainerView.superview) return; - self.menuContainerView.frame = self.view.bounds; + CGRect frame = self.view.bounds; + frame.origin.x = 0; + //Account for notification bar + frame.origin.y = 20; + frame.size.height = frame.size.height - 20; + + self.menuContainerView.frame = frame; self.menuContainerView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; [self.view insertSubview:menuContainerView atIndex:0]; if(self.leftMenuViewController && !self.leftMenuViewController.view.superview) { - [self.menuContainerView addSubview:self.leftMenuViewController.view]; + //added to account for when app is started in landscape that it takes the right size + self.leftMenuViewController.view.frame = frame; + [self.menuContainerView addSubview:self.leftMenuViewController.view]; } if(self.rightMenuViewController && !self.rightMenuViewController.view.superview) { + //added to account for when app is started in landscape that it takes the right size + self.rightMenuViewController.view.frame = frame; [self.menuContainerView addSubview:self.rightMenuViewController.view]; } } @@ -755,4 +765,4 @@ - (CGFloat)animationDurationFromStartPosition:(CGFloat)startPosition toEndPositi return MIN(duration, self.menuAnimationMaxDuration); } -@end \ No newline at end of file +@end