You're drawing wrapped text in a simple rectangle in CoreText, and you want to figure out the height of it. (fixed width, flexible height).CTFramesetterRef fsetter = CTFramesetterCreateWithAttributedString (attrString); CFRange fitRange; CGSize frameSize = CTFramesetterSuggestFrameSizeWithConstraints (fsetter, CFRangeMake (0, 0), NULL, // frame attributes CGSizeMake (rect.size.width, CGFLOAT_MAX), &fitRange);fitRange
is the range of characters that fit in. Given a height of CGFLOAT_MAX, this should be the entire string.frameSize
is the width and height the text will be wrapped in. A{ 0, 0}
range means to use the whole string.