One Quickie

Getting wrapped height from CoreText (Core Text->General)
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,
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.

borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book