重新加载UICollectionView页眉或页脚? [英] Reload UICollectionView header or footer?
问题描述
我有一些数据是在另一个更新UICollectionView标头的线程中获取的。但是,我没有找到一种重新加载补充视图(如页眉或页脚)的有效方法。
I have some data that is fetched in another thread that updates a UICollectionView's header. However, I've not found an efficient way of reloading a supplementary view such as a header or footer.
我可以调用 collectionView reloadSections:
,但这会重新加载整个部分,这是不必要的。 collectionView reloadItemsAtIndexPaths:
似乎只是针对单元格(不是补充视图)。并且在标题本身上调用 setNeedsDisplay
似乎也不起作用。我错过了什么吗?
I can call collectionView reloadSections:
, but this reloads the entire section which is unnecessary. collectionView reloadItemsAtIndexPaths:
only seems to target cells (not supplementary views). And calling setNeedsDisplay
on the header itself doesn't appear to work either. Am I missing something?
推荐答案
您还可以使用
[[_collectionView collectionViewLayout] invalidateLayout]
这篇关于重新加载UICollectionView页眉或页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!