Llg Llg - 1 year ago 189
Swift Question

Add padding between label and its border

I have in my swift application some labels that should have border. I added border to my label but I want to have more spaces between the label and its border.

How can I do that?

Answer Source

Try this:

myLabel.frame.size.width = myLabel.intrinsicContentSize.width + 10
myLabel.frame.size.height = myLabel.intrinsicContentSize.height + 10
myLabel.textAlignment = .center
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download