I know similar questions have been asked before, so don't get snarky and link to previous answers. The reason I am repeating this is that none of the answers have worked.
I have a UIWebView, and I want to draw a pretty drop-shadow behind it. I have tried subclassing and using some CoreGraphics goodness in drawRect:, but to no avail. Can anyone point me in the right direction? Thanks.
You could place a
UIImageView
under theUIScrollView
with a slight offset, and give the image view a shadowy-looking image.In this case, it would be convenient to use the
stretchableImageWithLeftCapWidth:topCapHeight:
method ofUIImage
to get a shadow image that can have nicely blurred edges and corners without distorting if you alter its size.I think the usual quartz shadows are hard to apply to a
UIWebView
since you don't really have access to the raw drawing code, which would be the best place to plug that in.Addendum Here's a sample drop shadow image:
. It has 4 pixel cap size all around, for use with the above stretchableImage method, and an alpha of 80% (so it's 20% transparent in the middle, tapering out at the edges). Feel free to use it. They're easy to make with a selection + feathering in your favorite graphics app.