How to make UILabel in Swift a circle

前端 未结 7 1249
孤街浪徒
孤街浪徒 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:43

    //You can provide UserdefiendRunTimeConstraints on the Label using Storyboard or XIB  Select label and give 
    

    (Ex. Your Label Width=100 & Height=100)

     KeyPath =layer.cornerRadius
     Type = Number
     Value = 50
    
     KeyPath = layer.masksToBounds
     Type = Boolean
     Value = True
    
     KeyPath = layer.borderWidth
     Type = Number
     Value = 2
    

提交回复
热议问题