Skip to content
Browse files

Merge pull request #61 from nwest/master

Enables the option to set shadow color and shadow opacity
  • Loading branch information...
2 parents 72a5d25 + 2cf5ec5 commit 9ba0b1f11a364c7ca77dc4974774aaeccf27b6e2 Michael Frederick committed Mar 20, 2013
Showing with 18 additions and 2 deletions.
  1. +2 −0 MFSideMenu/MFSideMenu.h
  2. +16 −2 MFSideMenu/MFSideMenu.m
View
2 MFSideMenu/MFSideMenu.h
@@ -39,6 +39,8 @@ typedef void (^MFSideMenuStateEventBlock)(MFSideMenuStateEvent);
@property (nonatomic, assign) BOOL shadowEnabled;
@property (nonatomic, assign) CGFloat menuWidth; // size of the side menu(s)
@property (nonatomic, assign) CGFloat shadowRadius; // radius of the shadow
+@property (nonatomic, assign) CGFloat shadowOpacity;
+@property (nonatomic, assign) CGColorRef shadowColor;
// this can be used to observe all MFSideMenuStateEvents
@property (copy) MFSideMenuStateEventBlock menuStateEventBlock;
View
18 MFSideMenu/MFSideMenu.m
@@ -42,6 +42,8 @@ @implementation MFSideMenu
@synthesize shadowEnabled = _shadowEnabled;
@synthesize menuWidth = _menuWidth;
@synthesize shadowRadius = _shadowRadius;
+@synthesize shadowColor = _shadowColor;
+@synthesize shadowOpacity = _shadowOpacity;
#pragma mark -
@@ -57,6 +59,8 @@ - (id) init {
self.menuState = MFSideMenuStateClosed;
self.menuWidth = 270.0f;
self.shadowRadius = 10.0f;
+ self.shadowOpacity = 0.75f;
+ self.shadowColor = [UIColor blackColor].CGColor;
}
return self;
}
@@ -173,14 +177,24 @@ - (void)setShadowRadius:(CGFloat)shadowRadius {
[self drawMenuShadows];
}
+- (void)setShadowColor:(CGColorRef)shadowColor {
+ _shadowColor = shadowColor;
+ [self drawMenuShadows];
+}
+
+- (void)setShadowOpacity:(CGFloat)shadowOpacity {
+ _shadowOpacity = shadowOpacity;
+ [self drawMenuShadows];
+}
+
- (void) drawMenuShadows {
if(_shadowEnabled) {
// we draw the shadow on the rootViewController, because it might not always be the uinavigationcontroller
// i.e. it could be a uitabbarcontroller
[self drawRootControllerShadowPath];
- self.rootViewController.view.layer.shadowOpacity = 0.75f;
+ self.rootViewController.view.layer.shadowOpacity = self.shadowOpacity;
self.rootViewController.view.layer.shadowRadius = self.shadowRadius;
- self.rootViewController.view.layer.shadowColor = [UIColor blackColor].CGColor;
+ self.rootViewController.view.layer.shadowColor = self.shadowColor;
}
}

0 comments on commit 9ba0b1f

Please sign in to comment.
Something went wrong with that request. Please try again.