UILabel 使用剪辑渲染部分字符

发布于 2024-10-17 17:00:33 字数 198 浏览 0 评论 0原文

我希望 UILabel 通过将 lineBreakMode 设置为 Clip 来渲染部分字符。但它正在剪辑整个角色。是否有不同的方法来剪辑单词以便仅显示部分字符?

假设我有一个像

“Hello Word”这样的字符串,并且该字符串位于 myLabel 中,其宽度仅适合 5 个字符和“W”的一部分,我希望它仍然呈现“W”的一部分而不是丢弃它来自渲染。

I want a UILabel to render a partial character by setting the lineBreakMode to clip. But it is clipping the entire character. Is there a different way to clip a word so that only partial character is displayed?

Lets say I have a string like:

"Hello Word" and that string is in a myLabel with a width that only fits the 5 characters and part of the "W" I want it still to render part of the "W" and not drop it from the render.

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

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

发布评论

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

评论(1

鹿港巷口少年归 2024-10-24 17:00:33

我怀疑你必须将字符串渲染成图像并剪辑它。

I suspect you'd have to render the string into an image and clip that.

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