Ios – How to take an UIImage and give it a black border

iosiphoneobjective cuiimageuiimageview

How can I set the border of a UIImage?

Best Answer

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];