Sohaib Sohaib - 1 year ago 208
iOS Question

Dashed line border around UIView

How do I add dashed line border around


Something Like this

Answer Source

It's very simple:

[yourView.layer setBorderWidth:5.0];
[yourView.layer setBorderColor:[[UIColor colorWithPatternImage:[UIImage imageNamed:@"DotedImage.png"]] CGColor]];///just add image name and create image with dashed or doted drawing and add here

Here you're just required to add QuartzCore/QuartzCore.h framework in project and import it as below in .m file

#import <QuartzCore/QuartzCore.h>

I hope this helps you

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download