I need to determine uicollectionview's height.
let layout = contactCollectionView.collectionViewLayout
let heightSize = String(Int(layout.collectionViewContentSize.height))
The above solution works on some situations in my project. In this specific situation I need to count number of rows and then multiple it with a number to find height.
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// height = (count rows) * 30 . every cell height is 30
// every cell has different width.
return (presenter?.selectedContact.count)!
}
How can I find number of rows?
Update
This is my collectionView. Every cell has different width(because it is string). So It has different rows. The width of this collectionView is width of view.frame