title: Getting size of NSAttributedString
body: <p>I've been trying to get the size of an NSAttributedString like this:</p>
  
  <pre><code>CGSize myPaperSize = CGSizeMake(myPaperWidth, CGFLOAT_MAX);
  
  UIFont *font = [UIFont fontWithName:@"Trebuchet MS" size:12.0f];
  
  //TODO: Fix problem with printing. When we print it's overlapping because of how the printer gets its size
  
  /**
  
      We currently want to do it by the size of the text. But for some reason it only does it well for two lines. Over two lines overlaps
   */
  
  NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init];
  style.lineBreakMode = NSLineBreakByWordWrapping;
  
  //Attributes of my text
  NSAttributedString *attributedString = [[NSAttributedString alloc] initWithString:newFormatter.text attributes:@{NSFontAttributeName: font, NSParagraphStyleAttributeName: style}];
  
  CGRect stringRect = [attributedString boundingRectWithSize:paperRect options: NSStringDrawingUsesLineFragmentOrigin context:nil];
  CGSize stringSize = CGSizeMake(stringRect.size.width, stringRect.size.height);
  
  
  //Here I want to update the size of the paper by adding the distance from last formatter plus whatever the height of the string is.
  self.slipHeight += distanceFromFormatterAbove + ceil(stringSize.height);
  </code></pre>
  
  <p>This works when the text is two lines on my piece of paper. But when the text is more than 3 lines it doesn't work. Any one have any idea how to get this to work (ios7)? Let me know if you have any questions.</p>