2016年10月22日 星期六

swift3 Day8 UILabel 圓角 circle

這是昨天宣告的 UILabel 



var testLabel = UILabel(frame: CGRect(x: 0, y: 20, width: 80, height: 80))



 



設定圓角會影響的 backgroundColor



testLabel.layer.backgroundColor = UIColor.orange.cgColor



 



圓角的寫法



testLabel.layer.cornerRadius = 40



數字=UILabel 大小的一半,為正圓形





 



加上框線



//框線顏色預設是黑的



testLabel.layer.borderWidth = 3.0





 



//框線顏色設定成綠色



testLabel.layer.borderColor = UIColor.green.cgColor





 



這個Label 一樣可以設定文字



 



 



 




0 意見:

張貼留言