NSString has metric features like
sizeWithFont:forWidth:lineBreakMode:
which you will need to use. In fact, I usually use sizeWithFont:constrainedToSize:lineBreakMode:after creation CGSizeMake(columnWidth, FLT_MAX), which is then used for the result as well - with FLT_MAX as the height, only the width is limited. The resulting CGSize will return you the actual height.
I think that with this in mind, it will be much easier for you to use two UITextViewsand break the text into two sections.
source
share