I want to set a corner radius for partial text on UILabel. I've got the range.
The following code set the background color, but it gonna be a rectangle background.
So, my problem is how to set a corner radius to it ?
string.setAttributes([NSBackgroundColorAttributeName: UIColor.red], range: range)
Thank you for any suggestion.
yourLabel.layer.backgroundColor = UIColor.redColor().CGColor
yourLabel.layer.cornerRadius = 5 //Change this value as your requirement
yourLabel.layer.masksToBounds = true
May this code will help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.