Makes drawBottomCurvedShadowsOnRect more flexible by allowing the rect to be passed in with a non (0,0) origin

This commit is contained in:
Robinson, Blake 2020-03-18 11:27:37 -04:00
parent 0fb60b338b
commit 44bd74c683

View File

@ -260,15 +260,15 @@ static const CGFloat VertialShadowOffset = 6;
UIBezierPath *shadowPath = [UIBezierPath bezierPath];
//get the variables for frame
CGFloat x = 0;
CGFloat y = 0;
CGFloat x = rect.origin.x;
CGFloat y = rect.origin.y;
CGFloat width = CGRectGetWidth(rect);
CGFloat height = CGRectGetHeight(rect);
[shadowPath moveToPoint:CGPointMake(x + HorizontalShadowInset, y)];
[shadowPath addLineToPoint:CGPointMake(width - HorizontalShadowInset, y)];
[shadowPath addLineToPoint:CGPointMake(width - HorizontalShadowInset, height-VertialShadowOffset/2)];
[shadowPath addQuadCurveToPoint:CGPointMake(x + HorizontalShadowInset, height - VertialShadowOffset/2) controlPoint:CGPointMake(width/2.f, height - VertialShadowOffset * 1.5)];
[shadowPath addLineToPoint:CGPointMake(x + width - HorizontalShadowInset, y)];
[shadowPath addLineToPoint:CGPointMake(x + width - HorizontalShadowInset, height-VertialShadowOffset/2)];
[shadowPath addQuadCurveToPoint:CGPointMake(x + HorizontalShadowInset, height - VertialShadowOffset/2) controlPoint:CGPointMake((x + width)/2.f, height - VertialShadowOffset * 1.5)];
[shadowPath addLineToPoint:CGPointMake(x + HorizontalShadowInset, y)];
[shadowPath closePath];