Skip to content

Commit

Permalink
Cleaned up setter methods
Browse files Browse the repository at this point in the history
Added shadow color property from mutualmobile#294
  • Loading branch information
kcharwood committed Mar 11, 2015
1 parent dd06fde commit 8fa08d8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
7 changes: 7 additions & 0 deletions MMDrawerController/MMDrawerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ typedef void (^MMDrawerControllerDrawerVisualStateBlock)(MMDrawerController * dr
*/
@property (nonatomic, assign) CGSize shadowOffset;

/**
The color of the shadow drawn off of 'centerViewController` when a drawer is open.
By default, this is set to the systme default (opaque black).
*/
@property (nonatomic, strong) UIColor * shadowColor;

/**
The flag determining if a custom background view should appear beneath the status bar, forcing the child content to be drawn lower than the status bar. This property is only available for > iOS 7.0 to take into account for the new behavior of the status bar.
Expand Down
17 changes: 12 additions & 5 deletions MMDrawerController/MMDrawerController.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,16 @@ -(void)commonSetup{
[self setCenterHiddenInteractionMode:MMDrawerOpenCenterInteractionModeNavigationBarOnly];

// set shadow related default values
self.shadowOpacity = MMDrawerDefaultShadowOpacity;
self.shadowRadius = MMDrawerDefaultShadowRadius;
self.shadowOffset = CGSizeMake(0, -3);
[self setShadowOpacity:MMDrawerDefaultShadowOpacity];
[self setShadowRadius:MMDrawerDefaultShadowRadius];
[self setShadowOffset:CGSizeMake(0, -3)];
[self setShadowColor:[UIColor blackColor]];

// set default bezel range for panGestureReconizer
self.bezelPanningCenterViewRange = MMDrawerBezelRange;
[self setBezelPanningCenterViewRange:MMDrawerBezelRange];

// set defualt panVelocityXAnimationThreshold
self.panVelocityXAnimationThreshold = MMDrawerPanVelocityXAnimationThreshold;
[self setPanVelocityXAnimationThreshold:MMDrawerPanVelocityXAnimationThreshold];
}

#pragma mark - State Restoration
Expand Down Expand Up @@ -885,6 +886,11 @@ - (void)setShadowOffset:(CGSize)shadowOffset{
[self updateShadowForCenterView];
}

- (void)setShadowColor:(UIColor *)shadowColor{
_shadowColor = shadowColor;
[self updateShadowForCenterView];
}

-(void)setOpenSide:(MMDrawerSide)openSide{
if(_openSide != openSide){
_openSide = openSide;
Expand Down Expand Up @@ -1280,6 +1286,7 @@ -(void)updateShadowForCenterView{
centerView.layer.shadowRadius = self.shadowRadius;
centerView.layer.shadowOpacity = self.shadowOpacity;
centerView.layer.shadowOffset = self.shadowOffset;
centerView.layer.shadowColor = [self.shadowColor CGColor];

/** In the event this gets called a lot, we won't update the shadowPath
unless it needs to be updated (like during rotation) */
Expand Down

0 comments on commit 8fa08d8

Please sign in to comment.