rajtharan-g
rajtharan-g

Reputation: 452

Setting corner radius without clipsToBounds works only for UIView type?

I have a UIView for which I set a cornerRadius property alone. The UIView updates its corners. But say I have a UILabel for which I set cornerRadius property alone without clipsToBounds, it does not work. Both are of type UIView, then why does it not work for UILabel

Upvotes: 1

Views: 295

Answers (1)

DonMag
DonMag

Reputation: 77486

Internally, UILabel has more than one layer... UIView does not.

You can use either:

myLabel.clipsToBounds = true

or

myLabel.layer.masksToBounds = true

Upvotes: 2

Related Questions