title: How to get the real height of text drawn on a CTFrame
body: <p>
  I have a certain amount of text that fill some <code>CTFrame</code> (more than one). To create all frames (one for each page), I'm filling one frame, getting the text that didn't fitted the frame using <code>CTFrameGetVisibleStringRange</code> and repeating this process until all text is processed.</p>
  
  <p>On all frames, except the last, the text occupies the same height of page. On last frame I'd like to know the real height the text occupies, to know where I could start drawing more text.</p>
  
  <p>Is there any way to do this?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>As requested on comments, here's my solution using @omz 's suggestion:</p>
  
  <p>I'm using ARC on my project:</p>
  
  <pre class="lang-objective-c prettyprint-override"><code>CTFrameRef locCTFrame = (__bridge CTFrameRef)ctFrame;
  
  //Save CTLines
  lines = (NSArray *) ((__bridge id)CTFrameGetLines(locCTFrame));
  
  //Get line origins
  CGPoint lOrigins[MAXLINESPERPAGE];
  CTFrameGetLineOrigins(locCTFrame, CFRangeMake(0, 0), lOrigins);
  CGFloat colHeight = self.frame.size.height;
  
  //Save the amount of the height used by text
  percentFull = ((colHeight - lOrigins[[lines count] - 1].y) / colHeight);
  </code></pre>