Reputation: 53
I have collectionView Inside UITableViewCell
, and in UICollectionViewCell
I have UImageView
, when I run the project there are some free space, which i don't want: how can I fix it(by code or by storyboard - it doesn't matter)
Upvotes: 0
Views: 39
Reputation: 232
You should fix it by code. You can manage space between two UICollectionView
cells by using UICollectionViewDelegateFlowLayout
methods.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: collectionView.frame.width, height: collectionView.frame.height)
}
Provide the cell height and width in the above method.
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
The above method use for a vertically scrolling grid, this value represents the minimum spacing between successive rows. For a horizontally scrolling grid, this value represents the minimum spacing between successive columns.
Upvotes: 1