我想为UILabel上的部分文本设置一个拐角半径。我拿到了靶场。
下面的代码设置背景颜色,但它将是一个矩形背景。
所以,我的问题是如何给它设置一个拐角半径,
string.setAttributes([NSBackgroundColorAttributeName: UIColor.red], range: range)
谢谢你的建议。
发布于 2017-08-06 05:47:52
yourLabel.layer.backgroundColor = UIColor.redColor().CGColor
yourLabel.layer.cornerRadius = 5 //Change this value as your requirement
yourLabel.layer.masksToBounds = true
希望这段代码能帮到你。
https://stackoverflow.com/questions/45527840
复制相似问题