CollectionViewCell 子层未在 iOS 10 上更新

CollectionViewCell sublayer not updated on iOS 10

在 iOS 10 之前,设置我的 CollectionViewCell 子层内容运行良好,在 iOS 10,一些单元格没有刷新。

我试图强制 cell/layer 刷新但没有任何改变。

我发现使我的 collectionView 的 collectionViewLayout 无效,刷新了我所有的单元格,图层内容也被刷新了。

你知道为什么吗?

谢谢

蒂埃里

我找到了导致问题的原因。 在 willDisplayCell 中,我正在清除 layer.contents,在 cellForRowAtIndexPath 中,我设置了 layer.contents.

但是在 willDisplayCell 之前调用了 cellForRowAtIndexPath。

https://tech.zalando.de/blog/proper-use-of-cellforrowatindexpath-and-willdisplaycell/

我不知道它为什么在 iOS 9...