acithium
acithium

Reputation: 109

Custom border around uitextview

I'm trying to make a customized border around a UITextview that contains characters instead of the default border options. Any pointer on how to accomplish this?

Below is an example of what I'm trying to do. I'm sure that I can probably do this with a label by putting it over a UITextview, but I wanted to at least ask and see if anyone knew how to do this with a customized border.

enter image description here

Upvotes: 0

Views: 272

Answers (2)

Kumar KL
Kumar KL

Reputation: 15335

Hopefully, you need a image(texted border) with all your need to the UItextView border :

then try something like this :

[self.txtView.layer setBorderWidth:3.0];
[self.txtView.layer setBorderColor:[[UIColor colorWithPatternImage:[UIImage imageNamed:@"textedImage.png"]] CGColor]];

Upvotes: 1

Gajendra Rawat
Gajendra Rawat

Reputation: 3663

USe this code.

txtfld.layer.borderColor=[[UIColor blackColor]CGColor];

txtfld.layer.borderWidth=1.0;

and remember to import #import <QuartzCore/QuartzCore.h> in your .h file

You can also specify your RGB value.

txtfld.layer.borderColor=[[UIColor colorWithRed:178.0f/255.0f green:178.0f/255.0f blue:178.0f/255.0f alpha:1.0] CGColor];

Upvotes: 0

Related Questions