我正在以編程方式創建UILabel
。但下面的代碼不會給我圓角。我想我錯過了一些非常基本的東西。UILabel swift的圓角
var textLabel:UILabel? = UILabel()
textLabel?.text = text
textLabel?.frame = CGRect(x:point.x, y:point.y, width:(textLabel?.intrinsicContentSize.width)!, height:15)
textLabel?.backgroundColor = UIColor.white
textLabel?.font = UIFont(name:"OpenSans", size:8)
textLabel?.sizeToFit()
textLabel?.layer.cornerRadius = 20.0
任何人都可以請我指出正確的方向嗎?
的可能的複製[如何做出的UIImage/- 查看帶有圓角的CGRect(SWIFT)](https://stackoverflow.com/questions/25476139/how-do-i-make -an-uiimage-view-with-rounded-corners-cgrect-swift) –