How do I round only the top two corners of a UILabel?

后端 未结 3 430
忘掉有多难
忘掉有多难 2020-12-28 23:42

I know that in iOS 3.0+ I can use

 label.layer.cornerRadius = xxx;

to round all four corners of a UILabel (as a UIView subclass), but I wa

3条回答
  •  时光说笑
    2020-12-29 00:22

    I have checked the Class Reference for UIView & UILabel and its layers, but could not find any way to do this with the means given by the iOS.

    You could do one thing, create a UIView & apply rounded corners to it. Now add a UILabel as a subview to this UIView & position it in such a way so that the bottom 2 rounded corners are covered by the label. This way you get the effect you need...

提交回复
热议问题