Permalink
Browse files

exposing shadow opacity and color

  • Loading branch information...
1 parent 72a5d25 commit 2cf5ec50a208c357ee54a37fb39d0601069d8821 @nwest committed Mar 20, 2013
Showing with 18 additions and 2 deletions.
  1. +2 −0 MFSideMenu/MFSideMenu.h
  2. +16 −2 MFSideMenu/MFSideMenu.m
View
@@ -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
@@ -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 2cf5ec5

Please sign in to comment.