我有动态细胞大小的CollectionView。我已经成功地实施了它。但是现在我要修复所有部分中的行
0-3细胞
第1-2节细胞
第2-3节细胞
第4-2节细胞等等。
我该怎么做呢。
我已经像这样实现了numberOfItemsInSection
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
if (section == 0)
{
return 3;
}
else if (section % 2 != 0)
{
return 2;
}
else
{
return 3;
}
}但是我有点困惑,数数numberOfSection,我怎么能做到这一点?
例如:如果我有8项要显示。3段的指数为0-3细胞,指数为2-2细胞和3-3细胞.
我如何才能做到这对任何数量的项目在收藏品视图。
发布于 2016-08-09 07:34:52
例子:
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return 4
}
func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
numberOfSectionsInCollectionView(collectionView)
}https://stackoverflow.com/questions/38844369
复制相似问题