I have a UICollectionView for which I've implemented a custom subclass of UICollectionViewFlowLayout and implemented the layoutAttributesForElementsInRect method. My view is scrollable and I've implemented the shouldInvalidateLayoutForBoundsChange method to return YES. So every time I scroll, layoutAttributesForElementsInRect gets called.
But when I'm scrolling around in the top half of my view, the rect it gets called with is the rect for the whole collection (e.g. {{0, 0}, {320, 1136}} {{0, 567}, {320, 548}}), and when I scroll past halfway the rect becomes only the bottom half (i.e. {{0, 568}, {320, 568}} {{0, 568}, {320, 548}}). This completely breaks my layout. I need layoutAttributesForElementsInRect to always get called with the rect for the whole view.
Why did it use that other rect, and how can I turn off the rect-changing behavior?