How to make UILabel in Swift a circle

前端 未结 7 1169
孤街浪徒
孤街浪徒 2021-01-04 20:03

I am trying to make a UILabel in Swift a perfect circle. I am currently using the following:

pResult.layer.masksToBounds = true
pResult.layer.cornerRadius =          


        
相关标签:
7条回答
  • 2021-01-04 20:45

    Based on the previous answer, but this one in Swift 4.2 :

        label.layer.cornerRadius =  label.frame.width/2
        label.layer.masksToBounds = true
    
    0 讨论(0)
提交回复
热议问题