views:

735

answers:

2

I have a UITextView and a WebView side by side and I would like to add a drop shadow to both. This is an iPad app, so they rotate, thus an ImageView under them probably would not work. Any ideas?

+2  A: 

UIViews have CALayers, that have some built-in shadow support. Try these properties out:

view.layer.shadowColor
view.layer.shadowOffset
view.layer.shadowOpacity
view.layer.shadowRadius

That may get you what you need pretty quickly. You might need to #import <QuartzCore/QuartzCore.h> to get the compiler to understand what's going on.

jexe
Was able to figure it out. Thanks!
Care to post your solution? The accepted answer doesn't seem to work for me as written.
Typeoneerror
fantastic! If you were a woman I would propose now! :-)thanks!
Digital Robot
A: 

the solution would be like

[myTextBox.layer setShadowColor:[[UIColor blackColor] CGColor]];
[myTextBox.layer setShadowOffset:CGSizeMake(1.0, 1.0)];
[myTextBox.layer setShadowOpacity:1.0];
[myTextBox.layer setShadowRadius:0.3];

but this just works for OS 3.2 and up.

Digital Robot