Objective c UICollectionView单元格之间的空间

Objective c UICollectionView单元格之间的空间,objective-c,uicollectionview,uicollectionviewcell,calayer,uicollectionviewlayout,Objective C,Uicollectionview,Uicollectionviewcell,Calayer,Uicollectionviewlayout,在我的例子中,我希望完全删除UICollectionViewCell之间的所有空格。在iPhone5中,它工作正常,但在iPhone6及更高版本中工作正常。每次我滚动或在初始加载UICollectionView时,都会为不同的行添加空白。我知道这可能是浮点值的不同。例如8.8888881和8.8888881 绿线是空白(收藏视图背景色) 每次我滚动此行时,都会更改位置 我的代码: - (CGSize)collectionView:(UICollectionView *)collectionV

在我的例子中,我希望完全删除
UICollectionViewCell
之间的所有空格。在iPhone5中,它工作正常,但在iPhone6及更高版本中工作正常。每次我滚动或在初始加载
UICollectionView
时,都会为不同的行添加空白。我知道这可能是浮点值的不同。例如8.8888881和8.8888881

绿线是空白(
收藏视图
背景色)

每次我滚动此行时,都会更改位置

我的代码:

- (CGSize)collectionView:(UICollectionView *)collectionView
                  layout:(UICollectionViewLayout *)collectionViewLayout
  sizeForItemAtIndexPath:(nonnull NSIndexPath *)indexPath
{
    CGFloat widthAndHeight = [self widthAndHeightForActiveCollectionViewItem];
    if (widthAndHeight < 22) {
        widthAndHeight = 22;
    }
    CGFloat result = lroundf(widthAndHeight * self.venueLayoutZoom);
    return CGSizeMake(result, result);
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 0;
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
{
    return UIEdgeInsetsZero;
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 0;
}
- (void)prepareForReuse
{
    [self.circularLayer removeFromSuperlayer];
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    [self allocAndAddLayers];
}

- (void)allocAndAddLayers
{
    self.circularLayer = [CALayer layer];
    [self.layer addSublayer:self.circularLayer];
}

- (void)layoutSubviews
{
    [self updateRoundedCorners];
}

- (void)updateRoundedCorners
{
   self.circularLayer.bounds = bounds;
        self.circularLayer.position = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds));
            CGRect rect = self.circularLayer.bounds;
            CGFloat radius = CGRectGetWidth(rect) / kVenueLayoutCellDefaultCornerRadiusDivider;
            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:rect byRoundingCorners:corners cornerRadii:CGSizeMake(radius, radius)];
            CAShapeLayer *maskLayer = [CAShapeLayer layer];
            maskLayer.frame = bounds;
            maskLayer.path = maskPath.CGPath;
            self.circularLayer.mask = maskLayer;
}