Set the spacing of UICollectionViewCell and uicollectioncell.
Set the spacing of UICollectionViewCell
# Pragma mark-UICollectionView size (width and height, three rows on average)
-(CGSize) collectionView :( UICollectionView *) collectionView layout :( UICollectionViewLayout *) collectionViewLayout sizeForItemAtIndexPath :( NSIndexPath *) indexPath {
CGFloat width = ([UIScreen mainScreen]. bounds. size. width)/3;
Return CGSizeMake (width, width );
}
// Set the spacing. If the default spacing is not set to a large value, the row cannot contain three cells.
-(CGFloat) collectionView :( UICollectionView *) collectionView layout :( UICollectionViewLayout *) collectionViewLayout minimumLineSpacingForSectionAtIndex :( NSInteger) section {
Return 0;
}
-(CGFloat) collectionView :( UICollectionView *) collectionView layout :( UICollectionViewLayout *) collectionViewLayout minimumInteritemSpacingForSectionAtIndex :( NSInteger) section {
Return 0;
}