1

I'm getting super nitpicky here, because for the most part the border is working here, but the slightest piece of the image still pokes out behind a border I have set. I've tried adjusting the border size and it doesn't help. Is there something wrong with this code? See image below as well for what I'm talking about.

func makeItCircle () {
    userImage.layer.masksToBounds = false
    userImage.layer.cornerRadius = CGFloat(roundf(Float(self.userImage.frame.size.width/2.0)))
    userImage.contentMode = .ScaleAspectFill
    userImage.layer.borderColor = UIColor.whiteColor().CGColor
    userImage.layer.borderWidth = 3
    userImage.clipsToBounds = true
}

enter image description here

skind
  • 173
  • 1
  • 2
  • 17

2 Answers2

1

It is a known issue with borders. Check my answer to this question if you need a border, otherwise you could just use clearColor.

Community
  • 1
  • 1
Jelly
  • 4,522
  • 6
  • 26
  • 42
  • Interesting. I think I get most of that code, but the one line I'm having trouble translating to Swift is CAShapeLayer* frameLayer = [CAShapeLayer layer]; – skind Mar 24 '16 at 13:56
  • `let frameLayer = CAShapeLayer()` – Jelly Mar 24 '16 at 14:08
0

Its a border width,check by giving border width to just 0.5 or 1.0

  • That isn't it. I've tried to adjust the border width and the piece of the image still pokes through. – skind Mar 24 '16 at 22:13