Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions C360PopoverBackgroundView/C360PopoverBackgroundView.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,9 @@
@property (nonatomic, strong) UIColor *tintColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *borderColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *glowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) UIColor *shadowColor UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) NSNumber *shadowRadius UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) NSNumber *shadowOpacity UI_APPEARANCE_SELECTOR;
@property (nonatomic, strong) NSValue *shadowOffset UI_APPEARANCE_SELECTOR;

@end
35 changes: 34 additions & 1 deletion C360PopoverBackgroundView/C360PopoverBackgroundView.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ + (CGFloat)arrowBase

+ (UIEdgeInsets)contentViewInsets
{
return UIEdgeInsetsMake(8, 8, 8, 8);
return UIEdgeInsetsZero;
}

- (id)initWithFrame:(CGRect)frame
Expand Down Expand Up @@ -179,6 +179,30 @@ - (void)setGlowColor:(UIColor *)glowColor
[self setNeedsImageUpdate];
}

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

- (void)setShadowRadius:(NSNumber *)shadowRadius
{
_shadowRadius = shadowRadius;
[self setNeedsImageUpdate];
}

- (void)setShadowOpacity:(NSNumber *)shadowOpacity
{
_shadowOpacity = shadowOpacity;
[self setNeedsImageUpdate];
}

- (void)setShadowOffset:(NSNumber *)shadowOffset
{
_shadowOffset = shadowOffset;
[self setNeedsImageUpdate];
}

- (CGFloat)cornerRadius
{
return 10;
Expand Down Expand Up @@ -968,6 +992,15 @@ - (void)updateImagesIfNeeded

}];

if (self.shadowColor) {
self.fillView.layer.shadowColor = [self.shadowColor CGColor];
self.fillView.layer.shadowOffset = [self.shadowOffset CGSizeValue];
self.fillView.layer.shadowRadius = [self.shadowRadius floatValue];
self.fillView.layer.shadowOpacity = [self.shadowOpacity floatValue];
} else {
self.fillView.layer.shadowColor = nil;
self.fillView.layer.opacity = 0.f;
}
}

- (UIImage *)drawImageWithWidth:(CGFloat)width height:(CGFloat)height block:(void(^)(CGContextRef context))block
Expand Down