title: NSString font size specific to frame width
body: <p>I am using <code>drawRect</code> for a text display, calling <code>NSString</code>. I am trying to implement using <code>sizeWithFont</code> to auto resizing font (shrinking) with default font size of 17 and using a loop to reduce the font size by 1 if it does not fit the size of width. Can anyone help me how to implement this? Example would be nice right now I just have the font size set to 17.0</p>
  
  <pre><code>[[self.string displayName] drawAtPoint:CGPointMake(xcoord, ycoord) withFont:[UIFont boldSystemFontOfSize:17.0]];
  CGSize size = [[self.patient displayName] sizeWithFont:[UIFont boldSystemFontOfSize:17.0]];
  max_current_y = size.height &gt; max_current_y ? size.height : max_current_y;
  xcoord = xcoord + 3.0f + size.width;
  </code></pre>