views:

190

answers:

0

Hi

I've written a UIView subclass which adds a nice soft shadow underneath a png image. I'm overriding the drawRect method to draw the image and add the shadow.

Now, when I try to do a scale/rotate-affine transform on the UIView (by calling the .transform method), I'm not getting the result I'm looking for due to the initial "flattening" of the drawRect method.

I'd like to "redraw" the shadow so that it stays at the same offset when scaling. I tried to override the transform method and redraw the image but without success.

I was wondering if I'm currently looking in the correct direction.

  • Should I actually redraw the image and create complicated CG transforms and add the shadow every time again?
  • Is this a performant way of redrawing things?
  • The transform method seems to resize the whole container, mixing up the anti-aliassing of the whole image, resulting in jagged edges. Any thoughts on that?