In my use of
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect
in a custom layout subclass, I only see rect coordinate values that are mostly multiples of 1024. Is this right? What am I doing wrong?
Here are the values I see as I scroll around a UICollectionView with dimensions of width=3780, height=3310, for rect (duplicates removed):
rect {{0, 0}, {1024, 1024}}
rect {{0, 0}, {2048, 1024}}
rect {{0, 0}, {2048, 2048}}
rect {{0, 1024}, {2048, 1024}}
rect {{0, 1024}, {2048, 2048}}
rect {{0, 2048}, {2048, 1024}}
rect {{0, 2048}, {2048, 1262}}
rect {{1024, 2048}, {2048, 1262}}
rect {{2048, 2048}, {1732, 1262}}
rect {{2048, 2048}, {1732, 1024}}
rect {{2048, 1024}, {1732, 2048}}
rect {{1024, 1024}, {2048, 2048}}
rect {{1024, 1024}, {2048, 1024}}
rect {{1024, 0}, {2048, 2048}}
rect {{1024, 0}, {1024, 2048}}
rect {{0, 0}, {2048, 2048}}
rect {{0, 0}, {2048, 1024}}
rect {{-1024, 0}, {2048, 1024}}
rect {{-1024, 0}, {2048, 2048}}
rect {{-0, 0}, {1024, 2048}}
rect {{0, 0}, {2048, 2048}}
rect {{1024, 0}, {2048, 2048}}
rect {{2048, 0}, {1732, 2048}}
What I expect to see is for the origin to reflect the contentOffset, and the size to always be the size of the screen.
Any ideas what is going on?
Two pieces of detail:
I'm testing on an iPad, and I invalidate the layout on bounds change, which is why layoutAttributesForElementsInRect is getting called when I scroll around.
-(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
return YES;
}
.zeroand sizecollectionView.contentSize. This always gave me every item, which I can check against the visible screen rect. - CIFilter