UIlabel layer.cornerRadius not working in iOS 7.1

Mike V picture Mike V · Mar 11, 2014 · Viewed 77.3k times · Source

I'm currently looking at a UILabel with the property addMessageLabel.layer.cornerRadius = 5.0f; On a device with iOS 7.0 installed, it has rounded corners. On a device with iOS 7.1 installed, it does not have rounded corners.

Is this just a bug with iOS 7.1?

Answer

Raheel Sadiq picture Raheel Sadiq · Mar 11, 2014

Set the property clipsToBounds to true

addMessageLabel.clipsToBounds = true