UILabel 没有显示我的所有文本,也没有显示更多 (...)
我正在动态确定单元格的高度,以适应我的所有文本。
我还将行数设置为 0。
大多数情况下它都有效,但有时我会得到这样的结果:
文本比显示的多,即使我记录标签文本,它显示的内容也比显示的内容多。
黑框用于表明框架足够大,可以容纳文本,但由于某种原因,标签拒绝显示我的所有文本。
有人经历过这样的事情吗?
谁能帮我解决这个问题吗?
我知道这并不复杂,但它让我发疯。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这种情况下,使用正确的函数来测量文本的大小非常重要。查看此博客文章:iPhone SDK中计算多行文本的高度。
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.
解决方案其实很简单,由于某种原因,行数被改变了,所以现在我只确保在单元格显示之前,标签的行数实际上是0。
谢谢大家的帮助!
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!