是否有一种简单的方法可以仅在 UICollectionViewFlowLayout 中重新加载辅助 View ?我不想重新加载整个东西。有可能吗?
最佳答案
查看文档后,我不确定是否要重新加载单个补充 View ,但您可以使用 reloadSections:
更新 UICollectionView 中的 1 个或多个部分。 ( documentation ) 因此,当节标题需要更新时,您可以调用:
objective-C :
[self.collectionView reloadSections:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, 3)]];
swift :
self.collectionView?.reloadSections(IndexSet(0 ..< 3))
恰好调用:
- (UICollectionReusableView *)collectionView: (UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath {
//Place logic for handling update here...
}
关于iphone - 如何在 collectionView 中重新加载补充 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14289669/