@@ -38,6 +38,9 @@ @implementation SlideNavigationController
3838#define MENU_SLIDE_ANIMATION_DURATION .3
3939#define MENU_QUICK_SLIDE_ANIMATION_DURATION .1
4040#define MENU_IMAGE @" menu-button"
41+ #define MENU_SHADOW_RADIUS 10
42+ #define MENU_SHADOW_OPACITY 1
43+ #define MENU_DEFAULT_SLIDE_OFFSET 60
4144
4245static SlideNavigationController *singletonInstance;
4346
@@ -80,16 +83,16 @@ - (id)initWithRootViewController:(UIViewController *)rootViewController
8083
8184- (void )setup
8285{
83- self.landscapeSlideOffset = 60 ;
84- self.portraitSlideOffset = 60 ;
86+ self.landscapeSlideOffset = MENU_DEFAULT_SLIDE_OFFSET ;
87+ self.portraitSlideOffset = MENU_DEFAULT_SLIDE_OFFSET ;
8588 self.avoidSwitchingToSameClassViewController = YES ;
8689 singletonInstance = self;
8790 self.delegate = self;
8891
8992 self.view .layer .shadowColor = [UIColor darkGrayColor ].CGColor ;
90- self.view .layer .shadowRadius = 10 ;
93+ self.view .layer .shadowRadius = MENU_SHADOW_RADIUS;
94+ self.view .layer .shadowOpacity = MENU_SHADOW_OPACITY;
9195 self.view .layer .shadowPath = [UIBezierPath bezierPathWithRect: self .view.bounds].CGPath ;
92- self.view .layer .shadowOpacity = 1 ;
9396 self.view .layer .shouldRasterize = YES ;
9497 self.view .layer .rasterizationScale = [UIScreen mainScreen ].scale ;
9598
@@ -102,11 +105,31 @@ - (void)viewWillLayoutSubviews
102105
103106 CGAffineTransform transform = self.view .transform ;
104107 self.leftMenu .view .transform = transform;
105- self.righMenu .view .transform = transform;
108+ self.rightMenu .view .transform = transform;
106109
107110 CGRect rect = self.view .frame ;
108111 self.leftMenu .view .frame = rect;
109- self.righMenu .view .frame = rect;
112+ self.rightMenu .view .frame = rect;
113+ }
114+
115+ - (void )viewDidLayoutSubviews
116+ {
117+ [super viewDidLayoutSubviews ];
118+
119+ }
120+
121+ - (void )willRotateToInterfaceOrientation : (UIInterfaceOrientation)toInterfaceOrientation duration : (NSTimeInterval )duration
122+ {
123+ [super willRotateToInterfaceOrientation: toInterfaceOrientation duration: duration];
124+
125+ self.view .layer .shadowOpacity = 0 ;
126+ }
127+
128+ - (void )didRotateFromInterfaceOrientation : (UIInterfaceOrientation)fromInterfaceOrientation
129+ {
130+ [super didRotateFromInterfaceOrientation: fromInterfaceOrientation];
131+
132+ self.view .layer .shadowOpacity = MENU_SHADOW_OPACITY;
110133}
111134
112135#pragma mark - Public Methods -
@@ -256,13 +279,13 @@ - (void)openMenu:(Menu)menu withDuration:(float)duration andCompletion:(void (^)
256279
257280 if (menu == MenuLeft)
258281 {
259- [self .righMenu .view removeFromSuperview ];
282+ [self .rightMenu .view removeFromSuperview ];
260283 [self .view.window insertSubview: self .leftMenu.view atIndex: 0 ];
261284 }
262285 else
263286 {
264287 [self .leftMenu.view removeFromSuperview ];
265- [self .view.window insertSubview: self .righMenu .view atIndex: 0 ];
288+ [self .view.window insertSubview: self .rightMenu .view atIndex: 0 ];
266289 }
267290
268291 [UIView animateWithDuration: duration
@@ -419,13 +442,13 @@ - (void)panDetected:(UIPanGestureRecognizer *)aPanRecognizer
419442
420443 if (newHorizontalLocation > 0 )
421444 {
422- [self .righMenu .view removeFromSuperview ];
445+ [self .rightMenu .view removeFromSuperview ];
423446 [self .view.window insertSubview: self .leftMenu.view atIndex: 0 ];
424447 }
425448 else
426449 {
427450 [self .leftMenu.view removeFromSuperview ];
428- [self .view.window insertSubview: self .righMenu .view atIndex: 0 ];
451+ [self .view.window insertSubview: self .rightMenu .view atIndex: 0 ];
429452 }
430453 }
431454 else if (aPanRecognizer.state == UIGestureRecognizerStateEnded)
0 commit comments