I'm setting the background color to a white border and the border is seeping through the background.I'm looking to have the blue line gone. Can you please suggest a solution to this problem?
Here is my code below. And there is an image of what I'm talking about below.
[
self.imageView.layer.borderColor = UIColor.white.cgColor
self.imageView.layer.borderWidth = 3
self.imageView.backgroundColor = UIColor.blue
self.imageView.layer.cornerRadius = CGFloat(CircleDiameter/2)
I guess this is what iOS rendering do with a layer have positive cornerRadius, I have Tested add a white circle view overlap a blue circle view which has the same size, the same situation appears:
In fact, through borderWidth Document the border of layer is drawn inset from the receiver’s bounds, so it has the same kind of situation as I mentioned above:
When this value is greater than 0.0, the layer draws a border using the current borderColor value. The border is drawn inset from the receiver’s bounds by the value specified in this property. It is composited above the receiver’s contents and sublayers and includes the effects of the cornerRadius property.
So borders + roundness = sadness on iOS and I think you need another way to implement your design.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With