iOS 9 - Swift 2
I have added a cornerRadius on a button. That makes a strange gray border on the non-cornered part of the button (see image). As soon as I remove cornerRadius, the border disappears.
Strange thing is that this gray border is visible only on device, NOT visible in the simulator.
Code is pretty simple and this is not happening on other buttons:
button.backgroundColor = UIColor.defaultAppColor()
button.layer.cornerRadius = 20
button.layer.masksToBounds = true
Image of button:

Has anybody experienced this before?
I could not find the solution to the problem, and it doesn't seem persistent. I think it has something to do with auto layout and the way the corner radius is applied.
Anyhow, I solved it by adding a border to the button with the same color as the background color.
Hope that helps other in same situation.
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