0

I've seen many variations of posts about adding padding to an image but none that have been able to help me. If you cannot provide me with an answer, can any of you all please steer me in the correct direction?

I have a circular imageview. I would like to add space around the circular image view before the border is shown such as this

How can i implement this? Thanks in advance

Jay
  • 686
  • 1
  • 4
  • 16
ILoveToCode22
  • 235
  • 1
  • 3
  • 12

1 Answers1

2

To do this, I embedded my UIImageView in a UIView. I set the constraints so that the the UIImageview is always a certain distance inside the the UIView. Then I gave the UIView the following properties:

    view.backgroundColor = nil
    view.layer.cornerRadius = view.bounds.width / 2
    view.layer.borderWidth = 1
    view.layer.borderColor = UIColor.red.cgColor
ILoveToCode22
  • 235
  • 1
  • 3
  • 12