Ich habe ein Problem mit UICollectionViewCell Design-Layout. Ich brauche Raum mit Animation zu entfernen, während zwischen UICollectionView Handy Scrollen, habe ich einige Delegatmethode von UICollectionView versuchen, wie -UICollectionViewCell Raum mit Animation beim Scrollen entfernen
- Collection - minimumLineSpacingForSectionAtIndex
- Collection - minimumInteritemSpacingForSectionAtIndex
- UIEdgeInsetsMake (0,0,0,0);
- scrollViewDidEndDragging
aber nicht in der Lage bis zur Marke. hier ist der Code:
- (CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGFloat screenWidth = screenRect.size.width;
float cellWidth = screenWidth/2.1; //Replace the divisor with the column count requirement. Make sure to have it in float.
CGSize size = CGSizeMake(cellWidth, cellWidth);
return size;
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
return 1.0;
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
return 1.0;
}
// Layout: Set Edges
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
return UIEdgeInsetsMake(0,0,0,0); // top, left, bottom, right
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
UIEdgeInsetsMake(0,0,0,0); // after scroll cell space not remove.
}
einige Code setzen, die Sie verwenden. –