为什么insetForSectionAtIndex不影响顶部和底部插入?

时间:2013-08-13 02:19:38

标签: ios objective-c uicollectionview uicollectionviewlayout

我有UICollectionView,使用基本流程布局。我已经实现了insetForSectionAtIndex方法,返回带有顶部和底部插图的UIEdgeInsets,以及左侧和右侧:

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {

    return UIEdgeInsetsMake(2.0f, 2.0f, 2.0f, 2.0f);
}

结果是每个单元格的左侧和右侧有2.0f“填充”,但顶部和底部没有“填充”。它是齐平的(0.0f)。我错过了什么?

感谢。

1 个答案:

答案 0 :(得分:0)

没有更多代码,很难提供帮助。

你有几个部分?如果它超过1,那么你可能还需要设置部分之间的间距。

另一种可能的想法是,UICollectionViewCells的内容大于你分配给它的大小。