1

I have set photoImageView.contentMode = UIViewContentMode.ScaleAspectFill. I want to put a border for the image. But since the content mode is AspectFill, I don't know how to programmatically add a border just to the image. Is there any way to do this? I use Swift 2 and Xcode beta 4

JMS
  • 271
  • 4
  • 15

1 Answers1

-1

Hi Jms i came up with few lines of code (I'm on beta 5,but i don't think there s difference)

@IBOutlet weak var image: UIImageView!

image.layer.borderColor = UIColor.blackColor().CGColor
image.layer.borderWidth = 4
image.clipsToBounds = true

Worked perfectly on my image, hope will help you.

Simone
  • 91
  • 1
  • 8