NSTextContainer的usedRectForTextContainer返回不正确的高度

我试图得到所需矩形的大小显示给定的文本容器中的文本与下面的代码:

s = [manager usedRectForTextContainer:container].size; 

我期望文本是在多行中,但是在行的末尾切断并且不显示下一行中的内容。 只有当有一些额外的字符时才会发生这种情况; 在大约60个字符的行中,下一行将显示10或15左右的剩余,但是不显示。

这可能是一个插入问题? 也许文字包装? 我真的不确定,因为我是iOS和UI编程的新手。

编辑:在上面的代码中,manager是一个NSLayoutManager ,而容器是一个NSTextContainer

我敢肯定,这是输出这个问题,因为在这个函数调用之后,如果我将s的值更改为我所期望的值,我将显示整个string的预期布局。

有关布局pipe理器的信息是

 <NSLayoutManager: 0xd203f60> 1 containers, text backing has 140 characters Currently holding 140 glyphs. Glyph tree contents: 140 characters, 140 glyphs, 1 nodes, 32 node bytes, 384 storage bytes, 416 total bytes, 2.97 bytes per character, 2.97 bytes per glyph Layout tree contents: 140 characters, 140 glyphs, 62 laid glyphs, 2 laid line fragments, 3 nodes, 96 node bytes, 856 storage bytes, 952 total bytes, 6.80 bytes per character, 6.80 bytes per glyph, 31.00 laid glyphs per laid line fragment, 476.00 bytes per laid line fragment 

我希望在这种情况下有三行,但看起来只有两行碎片,也许问题出在我的布局pipe理器中?