Sohaib Sohaib - 6 months ago 67
iOS Question

Dashed line border around UIView

How do I add dashed line border around


Something Like this


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