diff --git a/SlideMenu/Source/SlideNavigationController.h b/SlideMenu/Source/SlideNavigationController.h index edbb805..ab1a95d 100644 --- a/SlideMenu/Source/SlideNavigationController.h +++ b/SlideMenu/Source/SlideNavigationController.h @@ -44,6 +44,7 @@ typedef enum{ @property (nonatomic, assign) BOOL avoidSwitchingToSameClassViewController; @property (nonatomic, assign) BOOL enableSwipeGesture; +@property (nonatomic, assign) BOOL enableShadow; @property (nonatomic, strong) UIViewController *rightMenu; @property (nonatomic, strong) UIViewController *leftMenu; @property (nonatomic, strong) UIBarButtonItem *leftBarButtonItem; diff --git a/SlideMenu/Source/SlideNavigationController.m b/SlideMenu/Source/SlideNavigationController.m index debab65..86b33ca 100644 --- a/SlideMenu/Source/SlideNavigationController.m +++ b/SlideMenu/Source/SlideNavigationController.m @@ -97,23 +97,17 @@ static SlideNavigationController *singletonInstance; self.avoidSwitchingToSameClassViewController = YES; singletonInstance = self; self.delegate = self; - - self.view.layer.shadowColor = [UIColor darkGrayColor].CGColor; - self.view.layer.shadowRadius = MENU_SHADOW_RADIUS; - self.view.layer.shadowOpacity = MENU_SHADOW_OPACITY; - self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath; - self.view.layer.shouldRasterize = YES; - self.view.layer.rasterizationScale = [UIScreen mainScreen].scale; - - [self setEnableSwipeGesture:YES]; + self.enableShadow = YES; + self.enableSwipeGesture = YES; } - (void)viewWillLayoutSubviews { [super viewWillLayoutSubviews]; - // Update shadow size - self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath; + // Update shadow size of enabled + if (self.enableShadow) + self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath; } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration @@ -292,6 +286,24 @@ static SlideNavigationController *singletonInstance; return (self.horizontalLocation == 0) ? NO : YES; } +- (void)setEnableShaddow:(BOOL)enable +{ + if (enable) + { + self.view.layer.shadowColor = [UIColor darkGrayColor].CGColor; + self.view.layer.shadowRadius = MENU_SHADOW_RADIUS; + self.view.layer.shadowOpacity = MENU_SHADOW_OPACITY; + self.view.layer.shadowPath = [UIBezierPath bezierPathWithRect:self.view.bounds].CGPath; + self.view.layer.shouldRasterize = YES; + self.view.layer.rasterizationScale = [UIScreen mainScreen].scale; + } + else + { + self.view.layer.shadowOpacity = 0; + self.view.layer.shadowRadius = 0; + } +} + #pragma mark - Override Methods - - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated