Search code examples
iphonecocoa-touchuikitipadshadow

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?


Solution

  • 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.