Rect passed into UICollectionViewFlowLayout -layoutAttributesForElementsInRect is absurd when changing layouts

Originator:michele.titolo
Number:rdar://20812484 Date Originated:5/4/2015
Status:Open Resolved:
Product:iOS SDK Product Version:iOS 8.3
Classification:Other bug Reproducible:Always
 
Summary:
When subclassing UICollectionViewFlowLayout, and switching layout, the CGRect passed to -layoutAttributesForElementsInRect: does not represent the collectionView's contentSize or actual position.

The sample project logs both the rectangle and the collectionViewContentSize.

Steps to Reproduce:
1. Run sample project.
2. Toggle segmented control.
3. Watch logs, see the weird values being printed

Expected Results:
I expect the rect passed into -layoutAttributesForElementsInRect: can reasonably represent the collectionView in terms of frame and size.

Actual Results:
2015-05-04 19:14:27.952 FlowLayout[7792:614203] rect {{-667, -667}, {1010, 1334}}
2015-05-04 19:14:27.952 FlowLayout[7792:614203] size {343, 517}

The numbers just don't match up.

Version:
iOS 8.3

Notes:


Configuration:
Xcode 6.3.1(6D1002)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!