The method updateContentSizeIfNeeded not set correct size

The iOS demo project using updateContentSizeIfNeeded to get the layout frame and set the content size for text view. However, it looks like the height is not correct. There is always a huge spacer from the last paragraph to scroll view content bottom. (a.k.a calculated frame large than the real frame.

I'm trying to use the TextKit 2 to layout the text without scrolling enabled. Should I use the old way NSAttirubtedString's boundingRect or there is some new method to calculate the frame size.

Thanks.

Just make a simple debugging for this.

height = max(height, contentSize.height) is not required and should be removed from sample codes. Now the layout is the correct size.

The method updateContentSizeIfNeeded not set correct size
 
 
Q