我正在以UILabel编程方式创建.但下面的代码并没有给我圆角.我想我错过了一些非常基本的东西.
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
Run Code Online (Sandbox Code Playgroud)
有谁能指出我正确的方向?