I have a UICollectionView with FLowLayout. It will work as I expect most of the time, but from time to time one of the cells does not wrap properly. For example, a cell that should be included in the first "column" of the third row, if it actually ends in the second row, is just an empty place where it should be (see the diagram below). All that you can see in this gun cell is the left side (the rest are cut off), and the place where it should be is empty.
This does not occur sequentially; it is not always the same line. As soon as this happens, I can scroll up and then back, and the cell will be fixed. Or, when I click on a cell (which brings me to the next view by clicking), and then is discarded, I see the cell in the wrong position, and then it will move to the correct position.
Scrolling speed seems to make it easier to reproduce the problem. When I scroll slowly, I still see the cell in the wrong position from time to time, but then it will immediately move to the correct position.
The problem started when I added insert sections. Previously, I had cells that almost merged with the borders of the collection (small or without inserts), and I did not notice a problem. But this meant that the right and left views of the collection are empty. That is, it was not possible to scroll. In addition, the scroll bar was not hidden to the right.
I can solve the problem on both Simulator and iPad 3.
I assume the problem is due to the left and right sections of the insert ... But if the value is incorrect, I would expect the behavior to be consistent. I wonder if this could be a mistake with Apple? Or maybe it's related to creating an insert or something similar ...
Any solutions / workarounds appreciated.

Follow-up : I used this answer below Nick for more than 6 months 12 months 2 years without problems (in case people are wondering if there are any holes in this answer - I have not found them yet). Well done Nick.
ios ios6 uicollectionview uicollectionviewcell
lindon fox Oct 17 '12 at 4:18 2012-10-17 04:18
source share