how to make dynamic width of the UICollectionViewCell
<p>I want to set the width of <code>UICollectionViewCell</code> dynamically.
I found some code in swift and I want the code in Objective-C.</p>

<pre><code>let flowLayout = collectionViewLayout as! UICollectionViewFlowLayout
    if indexPath.item % 3 == 0 {
        let cellWidth = (CGRectGetWidth(collectionView.frame) - (flowLayout.sectionInset.left + flowLayout.sectionInset.right))
        return CGSize(width: cellWidth, height: cellWidth / 2)
    } else {
        let cellWidth = (CGRectGetWidth(collectionView.frame) - (flowLayout.sectionInset.left + flowLayout.sectionInset.right) - flowLayout.minimumInteritemSpacing) / 2
        return CGSize(width: cellWidth, height: cellWidth)
    }
</code></pre>