UILabel does not show all my text and it also doesn't show that there is more (…)

邮差的信 提交于 2019-12-08 10:32:09

问题


I am determining the height of my cells dynamically, to fit all my text.

I also set the number of lines to 0.

It works most of the time but sometimes I get things like this:

There is more text than is shown, and even if I log the label text, it shows more that what is being displayed.

The black frame is used to show that the frame is big enough to hold the text but for some reason the label refuses to show all my text.

Has anyone experienced anything like this?

Can anyone help me solve this?

I know it's not complicated but its been driving me crazy.


回答1:


In this instance, it is very important to use the correct function to measure the size of your text. Check out this blog post: Calculating Height of Multi-Line Text on the iPhone SDK.




回答2:


The solution was actually very simple, for some reason, the number of lines was being changed, so now I only make sure that before the cell is displayed, the number of lines for the label is in fact 0.

Thank you all for the help!



来源:https://stackoverflow.com/questions/7252428/uilabel-does-not-show-all-my-text-and-it-also-doesnt-show-that-there-is-more

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!