Rounded corners with Quartz

Here’s an easy way to add some rounded corners to a view in Xcode, say a UIWebView.

1. Import Quartz

#import "QuartzCore/QuartzCore.h"

2. Add the edges to your identified widget. Let’s say ours is a UIWebView called aboutWebView.

    // Round corners using CALayer property
    [[_aboutWebView layer] setCornerRadius:10];
    [_aboutWebView setClipsToBounds:YES];
    // Create colored border using CALayer property
    [[_aboutWebView layer] setBorderColor:
     [[UIColor colorWithRed:0.52 green:0.09 blue:0.07 alpha:1] CGColor]];
    [[_aboutWebView layer] setBorderWidth:2.75];   

That’s it. Quartz makes it that easy!

Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: