UICollectionViewCell 改变位置

UICollectionViewCell change position

默认情况下,当您创建集合视图时,会生成项目的顶部和底部边距。

我想移动单元格位置。 (从中到下) 有什么办法可以解决吗?

- (CGSize)collectionView:(UICollectionView *)collectionView
                  layout:(UICollectionViewLayout *)collectionViewLayout
  sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(collectionView.frame.size.width / 2.2, collectionView.frame.size.height-60);
}

好的。 更改集合视图流布局中的值。