GridView for UILabel in iOS
<p>Can anyone help me how to create this kind of grid? Each block has label inside.</p>

<p>I have created a for loop to add label vertically &amp; added as subview of <code>UIScrollView</code> earlier but it had fix size for all labels but this one has fix height for perticular row &amp; 4/8 different type of size is there, i am guessing it can be done via sizetofit but it will not give me the desired output.</p>

<p>Total two type of grid view are there which i m trying to achieve using following methods:</p>

<p>1) <code>UIView</code>+<code>UILabel</code>
2) <code>UiCollectionView</code></p>

<p><a href="https://i.stack.imgur.com/2PAXv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2PAXv.png" alt="Grid Sample"></a></p>

<p><a href="https://i.stack.imgur.com/weyx2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/weyx2.png" alt="Grid Sample 2"></a></p>