Assertion failure in -[UICollectionViewData validateLayoutInRect:]
UICollectionView使用自定義布局秒旋,在頻繁更新布局(reloadData
)的時候出現了這個報錯。
可能是在自定義布局類里執(zhí)行 prepareLayout
的時候沒有清空之前的UICollectionViewLayoutAttributes
數組,所以在這個方法最前面清空這個數組下隧。
[self.layoutAttributes removeAllObjects];
問題解決咨演!
可能還有其他的原因,我遇到的情況這樣就可以解決风纠。