title: how to set height of UILabel based on the text we have
body: <p>I have UILabel of width 260 where I have long text (maybe around 1000 characters).</p>
  
  <p>I wanted to set the height of the UILabel based on the content. Sometimes I can have 100 chars, sometimes I can have 1000 chars).</p>
  
  <p>Based on text, how can I set the height of the UILabel?</p>
  
  <p><strong>Note:</strong> I am creating UILabel programmatically.</p>
  
  <pre><code> UILabel myLabel = [[UILabel alloc] initWithFrame: CGRectMake (30,50,260, height)];
  </code></pre>
  
  <p>Any idea how to get this done?</p>
  
  <p><strong>One way I am trying is as below.</strong></p>
  
  <p>I am considering there are 40 chars in one line. So what I am doing is finding length of text and divide it by 40. This will give me total number of lines I required.</p>
  
  <p>But this fails when there are new lines.</p>
  
  <p>Is this right way?</p>