Skip to content

Commit

Permalink
Merge pull request jverkoey#383 from jverkoey/offset
Browse files Browse the repository at this point in the history
Add shadow offset support for NIGroupedCellBackground.
  • Loading branch information
stephanemoore committed Apr 30, 2013
2 parents 98e18b8 + 8c84e2d commit a2700d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/models/src/NICellBackgrounds.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ typedef enum {
@property (nonatomic, NI_STRONG) UIColor* innerBackgroundColor; // Default: [UIColor whiteColor]
@property (nonatomic, NI_STRONG) NSMutableArray* highlightedInnerGradientColors; // Default: RGBCOLOR(53, 141, 245), RGBCOLOR(16, 93, 230)
@property (nonatomic, assign) CGFloat shadowWidth; // Default: 4
@property (nonatomic, assign) CGSize shadowOffset; // Default: CGSizeMake(0, 1)
@property (nonatomic, NI_STRONG) UIColor* shadowColor; // Default: RGBACOLOR(0, 0, 0, 0.3)
@property (nonatomic, NI_STRONG) UIColor* borderColor; // Default: RGBACOLOR(0, 0, 0, 0.07)
@property (nonatomic, NI_STRONG) UIColor* dividerColor; // Default: RGBCOLOR(230, 230, 230)
Expand Down
4 changes: 3 additions & 1 deletion src/models/src/NICellBackgrounds.m
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ @implementation NIGroupedCellBackground
@synthesize highlightedInnerGradientColors = _highlightedInnerGradientColors;
@synthesize shadowWidth = _shadowWidth;
@synthesize shadowColor = _shadowColor;
@synthesize shadowOffset = _shadowOffset;
@synthesize borderColor = _borderColor;
@synthesize dividerColor = _dividerColor;
@synthesize borderRadius = _borderRadius;
Expand All @@ -54,6 +55,7 @@ - (id)init {
(id)RGBCOLOR(16, 93, 230).CGColor,
nil];
_shadowWidth = 4;
_shadowOffset = CGSizeMake(0, 1);
_shadowColor = RGBACOLOR(0, 0, 0, 0.3f);
_borderColor = RGBACOLOR(0, 0, 0, 0.07f);
_dividerColor = RGBCOLOR(230, 230, 230);
Expand Down Expand Up @@ -315,7 +317,7 @@ - (UIImage *)_imageForFirst:(BOOL)first last:(BOOL)last highlighted:(BOOL)highli

[self _applyPathToContext:cx rect:shadowFrame isFirst:first isLast:last];

CGContextSetShadowWithColor(cx, CGSizeMake(0, 1), self.shadowWidth, self.shadowColor.CGColor);
CGContextSetShadowWithColor(cx, self.shadowOffset, self.shadowWidth, self.shadowColor.CGColor);
CGContextDrawPath(cx, kCGPathFill);
CGContextRestoreGState(cx);
}
Expand Down

0 comments on commit a2700d0

Please sign in to comment.