This is driving me crazy! I have a UICollectionViewController as shown below:
class PhrasesCompactCollectionViewController: UICollectionViewController
In Swift 3+ Use this method:
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width:(collectionView.frame.height-90)/2, height: 100)
}
Make sure that your class complies both Delegate
UICollectionViewDelegate
UICollectionViewDelegateFlowLayout