UICollectionView Different Item Height Issue
<p><strong>Keypoints:</strong> </p>

<ol>
<li>I am using <strong>XIB</strong> with <strong>Autolayout</strong></li>
</ol>

<p>I am trying to create a <code>UICollectionView</code> that has a dynamic item height. This is needed because I have an <code>UILabel</code> that might have different heights due to it's length. The <code>UILabel</code>'s text is set using it's attributedText property</p>

<p><strong>I am aware that:</strong></p>

<ol>
<li>I <strong>MUST NOT</strong> implement <code>sizeForItemAtIndexpath</code>.</li>
<li>I <strong>MUST</strong> set <code>estimatedItemSize</code> to the flowLayout of my <code>UICollectionView</code>.</li>
</ol>

<p>I have been scavenging Stackoverflow for more than 6 hours but still unable to find solution but most of the solutions are either emphasizing on Storyboards or intended for lower version of iOS.</p>

<p>The best one i have found so far is this <a href="https://stackoverflow.com/a/31279726/2224226">UICollectionView Self Sizing Cells with Auto Layout</a> </p>

<p>However, that also did not fix my problem because somehow, my cell does not have the intended width.</p>

<p>Any ideas please?</p>

<p>.</p>

<p>.</p>

<p><em>Please help me vote this up cause I am literally banging my head now. Any help is very welcome.</em></p>