I have a UIView in which I am adding a UICollectionView
to act as a banner view to look like a carousel. The Viewcontroller
in which UIView
I was calling reloadData
from multiple places which caused the system to get confused (may be) especially I have written reloadData
in my updateconstraints
method and hence for each minor constraint change reloadData
was getting called.
Check all places from where you call reloadData
for collectionview
if you're experiencing the same problem.
Same problem.
Here's my situation:
My collection view has a custom layout. I use the default flow layout without any problem.
When I use my custom layout, whose cell width is a half screen width. When I scroll to the 5th cell, all cells became hidden without reason.
Finally I found out that when I set cell's size correctly in the layout class of the storyboard, the problem is resolved.
Hope this helps.
I've encountered the same problem.
After
without solving my problem, I realized that in some occasions CGSizeZero was returned for collectionView:layout:sizeForItemAtIndexPath:.
When avoiding the CGSizeZero result, everything works well.