UITextView having rounded corners

I’ve been using a UITextView in an app and realized that it didn’t have any rounded edges like the default behavior exhibited by the built-in iOS apps.  For example in the calendar app, setting the Notes field shows:

Inside of Apple’s Human Interface guidelines it specifically states “A text view is a rounded rectangle of any height. A text view supports scrolling when the content is too large to fit inside its bounds.”  Adding a UITextView to a view shows square corners by default.  So how the hell do you get rounded corners?  Interface Builder doesn’t show anything about corners.  Seems like the only way to get this behavior is by doing the following in code:

  1. Add: #import <QuartzCore/QuartzCore.h>
  2. And then add: textView.layer.cornerRadius = 10.0f;

Replace textView with the variable pointing to your UITextView.