5

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?

James Gu
  • 1,382
  • 4
  • 26
  • 39
  • Check this link out - it references UIWebViews but it's the same for UIImageViews - http://iosdevelopertips.com/cocoa/add-rounded-corners-and-border-to-uiwebview.html – wakachamo Jul 31 '13 at 01:05
  • Check this http://stackoverflow.com/a/1651383/1615838 – Quang Hà Jul 31 '13 at 01:14
  • 1
    Does any solution worked for you? Please give some feedback, upvote and accept one answer in order to remove it from the Unanswered section. – Lucas Eduardo Aug 01 '13 at 02:55

2 Answers2

17

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;
Lucas Eduardo
  • 11,525
  • 5
  • 44
  • 49
0

You're going to want to look at the QuartzCore docs, specifically the cornerRadius, borderColor and borderWidth properties within CALayer.

Dan
  • 5,153
  • 4
  • 31
  • 42