I mask CAGradientLayer with CAShapeLayer to create a bookmark that is inside specific rows in my table.

CGMutablePathRef path = CGPathCreateMutable(); CGPathAddLines(path, NULL, (CGPoint[]){ CGPointMake(8, 0), CGPointMake(22, 0), CGPointMake(22, 22), CGPointMake(15, 16), CGPointMake(8, 22) }, 5); CGPathCloseSubpath(path); CAShapeLayer *mask = [CAShapeLayer layer]; mask.fillColor = [UIColor redColor].CGColor; mask.bounds = CGRectMake(0, 0, 30, 30); mask.path = path; mask.anchorPoint = CGPointMake(0, 0); CGPathRelease(path); CAGradientLayer *favoriteBadge = [CAGradientLayer layer]; favoriteBadge.colors = @[(id)[UIColor colorWithRed:.97f green:0.5f blue:0.1f alpha:1.f].CGColor,
It looks too flat, so I want to end it with a shadow around the shape itself. I tried to include a shadow on the layer, but it does not seem to apply. I assume that it is applied in an area that is not inside the form. How to add a shadow to the figure itself?
I could copy the layer, darken it and shift its position by a few pixels, but that seems wasteful if CoreAnimation can do it more efficiently for me.
iphone core-animation
d11wtq
source share