tags:

views:

42

answers:

1

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 alpha and letting the GPU do the extraordinarily heavy compositing?

+1  A: 

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)

cobbal
but only in iPhone OS 3.2 +
dontWatchMyProfile