How to change UILabel width based on text length in iOS Using Auto-Layouts
<p>I want to display two  <code>UILabel</code>'s, however <code>UILabel</code>'s having variable text length's According to textsize <code>UIlabel</code>'s width need to increase using auto-layouts.</p>

<p>For this I wrote below auto-layouts for both <code>UIlabel</code>'s</p>

<p><strong>First Label:</strong></p>

<pre><code>1)leading Space 
2)Top space
3)Width
4)height
5)Horizontal spacing
</code></pre>

<p><strong>Second Label:</strong></p>

<pre><code>1)Trailing space
2)Top space
3)Width
4)height
</code></pre>

<p>how can we do this ? </p>

<p>Please help me.</p>

<h2>my code:</h2>

<pre><code>textLabel1.numberOfLines = 0
        textLabel1 .sizeToFit()
        textLabel1.text = "asdfdsfdghjgjhkhkjlhjkhjk"

textLabel2.numberOfLines = 0
        textLabel2 .sizeToFit()
        textLabel2.text = "asdfdsfdghjgjhkhkjlhjkhjk"
</code></pre>