Is there a simple way to let a layer throw an smooth shadow?
I was drawing a path into a layer. Lets say I can't access that drawing code in any way, because it comes from a compiled lib. Now I want to let that layer throw a shadow which matches the shape of its irregular content shape.
Is there an easy way to do it? Or must I draw like 20 of those layers and scale them up on every iteration, adjusting their a开发者_运维技巧lpha and letting the GPU do the extraordinarily heavy compositing?
every CALayer has the following properties:
- shadowOpacity
- shadowRadius
- shadowOffset
- shadowColor
- shadowPath
If you set shadowOpacity to something other than 0 (the default) you'll see a shadow.
(CALayer docs)
精彩评论