如何向UILabel添加填充? [英] How to add padding to an UILabel?

查看:67
本文介绍了如何向UILabel添加填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

UILabel内部的文本被左右边框粉碎.有没有一种方法可以在UILabel中添加一些内部填充,以使文本不会紧贴内部边界?

The text inside an UILabel is smashed against the left and right borders. Is there an way of adding some inner padding to the UILabel, so that text won't touch the inner borders so closely?

推荐答案

仅调整标签的位置(我不知道任何其他方法,尽管可能有人使用).如果您对背景颜色有疑问,例如,将背景设置为单独的UIView并将标签放在其顶部.

Just adjust the position of the label (I'm not aware of any other method, although someone else might). If you have an issue with background colors (for instance), make the background a separate UIView and put the label on top of it.

这篇关于如何向UILabel添加填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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