Skip to content

UITextView with border

April 15, 2010

Is this possible? Yes, you can have your UITextView with a border and that too with a rounded corner. I was in search of a way to achieve this for over 6 months and could not get it. So did a work around for that, by drawing a view with lines around and behind the UITextView.

But today I stumbled upon this thread and was able to discover a way to do that.

Any way I will share the code here. If there are any negative implications behind this solution, please share it.


yourTextView.layer.borderWidth = 1;

yourTextView.layer.cornerRadius = 8; //This is for achieving the rounded corner.

yourTextView.layer.borderColor = [[UIColor grayColor] CGColor];

And don’t forget to include the Quartz core framework.

#import  <QuartzCore/QuartzCore.h>

Bye !


From → iPhone

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: