How can i take an UIImage and give it a black border?

Shay picture Shay · Aug 30, 2009 · Viewed 108.1k times · Source

How can I set the border of a UIImage?

Answer

mclin picture mclin · Jun 10, 2010

With OS > 3.0 you can do this:

//you need this import
#import <QuartzCore/QuartzCore.h>

[imageView.layer setBorderColor: [[UIColor blackColor] CGColor]];
[imageView.layer setBorderWidth: 2.0];