在标签及其边框之间添加填充 [英] Add padding between label and its border

查看:120
本文介绍了在标签及其边框之间添加填充的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在快速申请中有一些应该有边框的标签。我在标签上添加了边框,但我想在标签和边框之间留出更多空格。

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.

我该怎么做?

推荐答案

试试这个:

myLabel.frame.size.width = myLabel.intrinsicContentSize.width + 10
myLabel.frame.size.height = myLabel.intrinsicContentSize.height + 10
myLabel.textAlignment = .center

这篇关于在标签及其边框之间添加填充的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆