如何在多行 iPhone UILabel 的开头添加首字下沉样式图像?
如何在多行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这不能通过
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 anotherUILabel
below those that spans the full width. And you'll have to calculate how much of the text can be shown in the firstUILabel
, 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.