【发布时间】:2012-12-07 20:27:49
【问题描述】:
我继承了UICollectionViewLayout。到目前为止,一切都很好。
但是,我有一些比屏幕更宽的单元格,有时这些单元格会在滚动时消失。当您再滚动一些时,它们会神奇地重新出现在应有的位置。我可以向您展示我的代码,但是我认为它没有任何问题,因为它在 90% 的情况下都有效。但是,真正大的单元格(超过屏幕尺寸的两倍)有时会消失。
NSMutableArray* attributes = [NSMutableArray array];
for (int section=0; section < [[self collectionView] numberOfSections]; section++) {
[attributes addObject:[self layoutAttributesForSupplementaryViewOfKind:UICollectionElementKindSectionHeader atIndexPath:[NSIndexPath indexPathForItem:0 inSection:section]]];
for (int row=0; row < [[self collectionView] numberOfItemsInSection:section]; row++) {
NSIndexPath* indexPath = [NSIndexPath indexPathForItem:row inSection:section];
[attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]];
}
}
return attributes;
我也有这些帖子:UICollectionView's cell disappearing 和 Large cells in a UICollectionView getting removed while the cell is still displayed 但是,没有提到解决方案。有人可以帮我吗?会不会是苹果那边的问题?如果是,有什么我可以自己解决的吗?
【问题讨论】:
标签: iphone ios uicollectionview