Example: CGFloat maxWidth = 150; NSAttributedString *s = [[NSAttributedString alloc] initWithString:@”The quick brown fox jumped over the lazy dog.” attributes:@{NSFontAttributeName:[UIFont fontWithName:@”GillSans” size:20]}]; NSTextContainer* tc = [[NSTextContainer alloc] initWithSize:CGSizeMake(maxWidth,CGFLOAT_MAX)]; NSLayoutManager* lm = [NSLayoutManager new]; NSTextStorage* tm = [[NSTextStorage alloc] initWithAttributedString:s]; [tm addLayoutManager:lm]; [lm addTextContainer:tc]; [lm enumerateLineFragmentsForGlyphRange:NSMakeRange(0,lm.numberOfGlyphs) usingBlock:^(CGRect rect, CGRect usedRect, NSTextContainer *textContainer, NSRange glyphRange, BOOL *stop) … Read more