iPhone 字符间距

发布于 2024-11-25 07:59:02 字数 207 浏览 2 评论 0原文

有没有办法在 UILabel 中添加字符间距?

我找到了一些例子,例如: 如何更改 UILabel/UIFont 的字母间距?

很难相信没有更简单的方法。

Is there a way to add character spacing in UILabel?

I found some examples like:
How to change an UILabel/UIFont's letter spacing?

But it's hard to believe that there isn't a easier way.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

菊凝晚露 2024-12-02 07:59:02

除了自定义 Quartz 绘图之外,没有其他方法可以实现您想要的目标,UILabel 不够灵活。然而,其他人已经接受了挑战,例如 OHAttributedLabel 允许您设置 NSAttributedString 作为标签的文本。尝试NSKernAttributeName,它会修改字偶距,但我从未在 iOS 上尝试过,只在 OS X 上尝试过。

There is no other to achieve what you want than doing custom Quartz drawing, UILabel is not flexible enough. However, other people have taken on the challenge, there is for example OHAttributedLabel which allows you to set an NSAttributedString as the label's text. Try the NSKernAttributeName, it modifies kerning but I've never tried this on iOS, only OS X.

地狱即天堂 2024-12-02 07:59:02

在IB中,您可以点击调整以适应和(以字体大小),并在布局中将行数设置为“0”,以达到接近您的要求。(或您也可以通过代码来完成)。

In IB you can click on Adjust to fit and (In font size), and set lines to '0' in in layout, to achieve near to your requirement.(or you can do it by code too).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文