我有一台UICollectionView。如何移动UICollectionView的第一个单元格?我需要得到一个像图像一样的结果。Shift对于每个部分是不同的。

发布于 2014-02-05 02:48:12
您需要创建一个用于collectionView的前3个单元格的虚拟单元格。我继续测试它,它工作正常。这不是完全可取的,因为您不能将索引0引用为视觉上明显的单元格0。
UICollectionViewCell *cell;
if (indexPath.row < self.dynamicNumberValue) {
NSString *cellIdentifier = @"cellIdentifierDummy";
cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
} else {
NSString *cellIdentifier = @"cellIdentifier";
cell = [collectionView dequeueReusableCellWithReuseIdentifier:cellIdentifier forIndexPath:indexPath];
collectionViewCell *collectionCell = (collectionViewCell *)cell;
[collectionCell.cellLabel setText:[NSString stringWithFormat:@"%d", self.cellNumber]];
self.cellNumber++;
}

https://stackoverflow.com/questions/21560178
复制相似问题