Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added FPPopoverPureWhiteTint and method to modify the FPPopoverView shadowOpacity Radius and Offset #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion FPPopoverController.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ typedef void (^FPPopoverCompletion)();
/** @brief Hide the shadows to get better performances **/
-(void)setShadowsHidden:(BOOL)hidden;


/** @brief Set Custom Tint color **/
-(void)setViewShadowOpacity:(float)opacity andRadius:(float)radius withOffset:(CGSize)offset;


@end
8 changes: 8 additions & 0 deletions FPPopoverController.m
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,14 @@ -(void)setShadowsHidden:(BOOL)hidden
}
}

-(void)setViewShadowOpacity:(float)opacity andRadius:(float)radius withOffset:(CGSize)offset
{
_contentView.layer.shadowOpacity = opacity;
_contentView.layer.shadowRadius = radius;
_contentView.layer.shadowOffset = offset;

}

#pragma mark 3D Border

-(void)setBorder:(BOOL)border
Expand Down
1 change: 1 addition & 0 deletions FPPopoverView.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ typedef enum {
FPPopoverLightGrayTint,
FPPopoverGreenTint,
FPPopoverRedTint,
FPPopoverPureWhiteTint,
FPPopoverDefaultTint = FPPopoverBlackTint
} FPPopoverTint;

Expand Down
34 changes: 30 additions & 4 deletions FPPopoverView.m
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,13 @@ -(CGGradientRef)newGradient
else if(self.tint == FPPopoverWhiteTint)
{
colors[0] = colors[1] = colors[2] = 1.0;
colors[4] = colors[5] = colors[6] = 0.3;
colors[3] = colors[7] = 1.0;
}
else if (self.tint == FPPopoverPureWhiteTint)
{
colors[0] = colors[1] = colors[2] = 1.0;
colors[4] = colors[5] = colors[6] = 1.0;
colors[3] = colors[7] = 1.0;
}

Expand Down Expand Up @@ -409,13 +415,25 @@ - (void)drawRect:(CGRect)rect
{
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1.0);
}
else if(self.tint == FPPopoverPureWhiteTint)
{
CGContextSetRGBFillColor(ctx, 1, 1, 1, 1.0);
}


CGContextFillRect(ctx, CGRectMake(0, end.y, self.bounds.size.width, self.bounds.size.height-end.y));
//internal border
CGContextBeginPath(ctx);
CGContextAddPath(ctx, contentPath);
CGContextSetRGBStrokeColor(ctx, 0.7, 0.7, 0.7, 1.0);

//For PureWhite
if(self.tint == FPPopoverPureWhiteTint){
CGContextSetRGBStrokeColor(ctx, 1.0, 1.0, 1.0, 1.0);
}else{
CGContextSetRGBStrokeColor(ctx, 0.7, 0.7, 0.7, 1.0);
}


CGContextSetLineWidth(ctx, 1);
CGContextSetLineCap(ctx,kCGLineCapRound);
CGContextSetLineJoin(ctx, kCGLineJoinRound);
Expand All @@ -437,12 +455,20 @@ - (void)drawRect:(CGRect)rect
if(self.draw3dBorder) {
CGRect cvRect = _contentView.frame;
//firstLine
CGContextSetRGBStrokeColor(ctx, 0.7, 0.7, 0.7, 1.0);
if(self.tint == FPPopoverPureWhiteTint){
CGContextSetRGBStrokeColor(ctx, 1.0, 1.0, 1.0, 1.0);
}else{
CGContextSetRGBStrokeColor(ctx, 0.7, 0.7, 0.7, 1.0);
}
CGContextStrokeRect(ctx, cvRect);
//secondLine
cvRect.origin.x -= 1; cvRect.origin.y -= 1; cvRect.size.height += 2; cvRect.size.width += 2;
CGContextSetRGBStrokeColor(ctx, 0.4, 0.4, 0.4, 1.0);
CGContextStrokeRect(ctx, cvRect);
if(self.tint == FPPopoverPureWhiteTint){
CGContextSetRGBStrokeColor(ctx, 1.0, 1.0, 1.0, 1.0);
}else{
CGContextSetRGBStrokeColor(ctx, 0.4, 0.4, 0.4, 1.0);
}
CGContextStrokeRect(ctx, cvRect);
}


Expand Down