如何在 UILabel 中换行
我有一个 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
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试增加 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.
可能与 UITableViewCell 高度有关。也许你不允许细胞生长
Could it be to do with the UITableViewCell height. Perhaps you are not allowing for the cell to grow