2016年10月21日 星期五

swift3 Day7 UILabel backgroundColor

將 UILabel 做更多變化,



例如:變成圓形



 



這是宣告 UILabel 



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





backgroundColor



UILabel 底色的方法



有沒有圓角都不影響整個 Label 底色



testLabel.backgroundColor = UIColor.green



 



 



將底色設為橘色



如果有圓角,則是會有圓角的底色



testLabel.layer.backgroundColor = UIColor.orange.cgColor



 



如果兩個 backgroundColor 都有設定,



testLabel.backgroundColor > testLabel.layer.backgroundColor



也就是整個 UILabel 都會綠綠的



 




0 意見:

張貼留言