Reputation: 169
how can i display 4 cells in each row for example (i have collectionView
have 10 rows, each row have 4 cells for different screens for all devices)on collectionView
for each device because i display (4 images for iPhone5 )and (for iPhone 6 is display 5 images )and (iPhone 6 plus it display 6 images )on cells i need to make all these different screens display 4 cells in each row in collectionView
.
thanks Advance
Upvotes: 1
Views: 1025
Reputation: 72460
You can pass your size like this
func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
let minSpace: CGFloat = 10
return CGSizeMake((collectionView.frame.size.width - minSpace)/4, YourCellHeight)
}
Upvotes: 1