UILable 文本不完整
嗨,我用谷歌搜索了一下,没有找到任何解决我的问题的方法。 我用一个大字符串填充 UILabels 文本,有时(并非每次都这样做)我的 UILabel.text 不完整(不是整个 NSString)。它主要发生在非常大的字符串上,但也发生在较短的字符串上。
有人遇到过这个问题吗,或者知道解决方法吗? 我真的不知道为什么会发生这种情况...
提示:我在 ScrollView 上使用带有 UILabel 的 IB。在视图的 ViewDidLoad 方法中,我使用 sizeWithFont 方法计算出 UILabel 的高度。 我在 IB 中使用 WordWrap、AlignBaseline 作为我的 UILabel
Hi i googled around a bit and didn´t find any solutions for my problem.
i fill a UILabels text with a large String, and sometimes (it doesn`t do so everytime) my UILabel.text is incomplete (not the whole NSString). It mostly happens with very large Strings but also with shorter ones.
Has anybody had that problem, or does know a workaround for this?
I really don`t know why this is happening...
Hint: I am using IB with a UILabel on a ScrollView. In the ViewDidLoad Method of the View i figure out the height of the UILabel with the sizeWithFont Method.
I use WordWrap, AlignBaseline for my UILabel in IB
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我确实将预期大小的方法更改为:
这是错误的:
cobbal 是对的...
但我很困惑,因为它之前似乎忽略了换行符,因为我的标签大小发生了变化
i did change my method for the expected size to this:
this was wrong:
cobbal is right...
but i am confused, because it seemed to be ignoring the newline characters before, cause my label size was variating
确保设置
numberOfLines
除了设置自动换行之外,还可以将其设置为 0。Make sure you set the
numberOfLines
to 0 in addition to setting word wrapping.