Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS rounded corner UIImage with border

Is there a way to make my image appear like this (rounded corners and with a light border).enter image description here

I'm thinking of creating a white mask that has the middle transparent to place on top, would that work?

like image 953
James Gu Avatar asked Jul 31 '13 01:07

James Gu


1 Answers

You can accomplish this, but instead of editing your UIImage, just do this in your UIImageView.

First, add the QuartzCore header

#import <QuartzCore/QuartzCore.h>

And then, edit the properties below, as you wish.

imageView.layer.cornerRadius = 5.0;
imageView.layer.borderColor = [[UIColor grayColor] CGColor];
imageView.layer.borderWidth = 2.0;
imageView.layer.masksToBounds = YES;
like image 136
Lucas Eduardo Avatar answered Oct 28 '22 06:10

Lucas Eduardo