Adding drop shadow to UIWebView and UITextView

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?


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


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.

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.

Here is swift version:

func applyDropShadow() {
    textView.layer.shadowColor = UIColor.blackColor().CGColor
    textView.layer.shadowOffset = CGSizeMake(3, 3)
    textView.layer.shadowOpacity = 0.7
    textView.layer.shadowRadius = 8.0
    textView.clipsToBounds = false


I would add a view that sits behind the text field, and apply the shadow effects to that. This way the shadow does not move with the content.

Need Your Help

sign_up using c#

c# database visual-studio

Hey i have created a sign_up method to insert into my database 'newSchool' using proc 'new_student' but whenever i try it in my browser gives me SqlException error at cmd.ExecuteNonQuery();

Parsing Excel sheet using javascript

javascript excel parsing

I'm using SheetJS in order to parse Excel sheets however I run into the following error: