I have a variable text that has a background color and rounded corners. So I'm using UILabel with NSMutableAttributedString.
myAttributedString = NSMutableAttributedString(string:"hello")
myAttributedString.addAttribute(NSBackgroundColorAttributeName, value: UIColor.red, range: NSRange(location: 0, length: myAttributedString.length))
myLabel.attributedText = myAttributedString
myLabel.layer.cornerRadius = 5
myLabel.clipsToBounds = true
myLabel.layer.masksToBounds = true
Im getting a label with rounded corners only on one side. What should I do to get rounded corners on all sides ?