How to Wrap words in UILabel

2019-07-21 04:38发布

问题:

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.

回答1:

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.



回答2:

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