如何在多行 iPhone UILabel 的开头添加首字下沉样式图像?

发布于 2024-10-16 15:09:13 字数 66 浏览 1 评论 0原文

如何在多行 iPhone UILabel 的开头添加图像,以便它开始第一行文本,但不会扰乱第二/第三/等行文本的流程?

How do you add an image in the beginning of a multiline iPhone UILabel so that it starts the first line of text but doesn't disrupt the flow of the second/third/etc line of text?

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

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

发布评论

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

评论(1

终止放荡 2024-10-23 15:09:13

这不能通过 UILabel 来完成。要实现此目的,您必须在图像右侧添加一个 UILabel,并在跨越整个宽度的图像下方添加另一个 UILabel。您必须计算第一个 UILabel 中可以显示多少文本,以便您知道要在底部标签中放置哪些文本。 UILabel 文本的可见部分 应该让您了解需要做什么计算第一个标签中有多少文本可见。

这不是一件容易的事,但它是可行的。

This cannot be done with a UILabel. To accomplish this, you're going to have to have the image with a UILabel to the right of it, and another UILabel below those that spans the full width. And you'll have to calculate how much of the text can be shown in the first UILabel, so that you know what text to put in the bottom label. UILabel visible part of text should give you an idea of what you'll need to do to calculate how much of the text is visible in the first label.

Not an easy task, but it's doable.

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