如何在UILabel中包装单词 [英] How to Wrap words in UILabel

查看:86
本文介绍了如何在UILabel中包装单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在自定义UITableViewCell里面有一个UILabel,我试图把这个词包装在UILabel里面。但是我遇到了一些问题。

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.

这就是UITableViewCell在Interface Builder中的样子

This is how the UITableViewCell looks in Interface Builder

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

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.

推荐答案

尝试增加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.

这篇关于如何在UILabel中包装单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆