如何在 UILabel 中换行

发布于 2024-12-27 14:42:38 字数 375 浏览 3 评论 0原文

我有一个 UILabel 位于自定义 UITableViewCell 内,我试图将单词包含在 UILabel 内。但是我遇到了一些问题。

这是 UITableViewCell 在 Interface Builder 中的外观

在此处输入图像描述

UILabel 标签需要换行..所以在 Interface Builder 中我已将标签行设置为0(我认为这意味着多行),并将换行符设置为单词..这应该将单词换行..

但是现在我认为我必须将一些代码放入某些内容中,以便如果单词将其换行扩大了细胞..我不知道该怎么做..我想知道这里是否有其他人以前经历过这个问题并可以帮助我。

I have a UILabel thats inside a Custom UITableViewCell, I am trying to get the word to wrap inside the UILabel.. But I am having some issues.

This is how the UITableViewCell looks in Interface Builder

enter image description here

The UILabel Label needs to wrap.. So in Interface Builder I have set the labels lines to 0 (which I think means multiple lines), and the line break to words.. which should wrap the words..

However now I think I have to put some code into something so that if the word wraps it expands the cell.. which I am not sure how to do.. I was wondering if anyone else here has experienced this issue before and could help me out.

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

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

发布评论

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

评论(2

画离情绘悲伤 2025-01-03 14:42:38

尝试增加 UILabel 的高度。仅当它可以容纳标签框架内的下一行时,它才会换行。

Try increasing the height of the UILabel. It will only wrap words if it can fit the next line within the frame of the label.

审判长 2025-01-03 14:42:38

可能与 UITableViewCell 高度有关。也许你不允许细胞生长

Could it be to do with the UITableViewCell height. Perhaps you are not allowing for the cell to grow

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