collectionViewLayout does not behave as expected

Originator:random4444
Number:rdar://16870885 Date Originated:09-May-2014 04:51 PM
Status:Open Resolved:
Product:iOS SDK Product Version:7.1.1
Classification:Other Bug Reproducible:Always
 
Summary:
UICollectionViewController’s layout property is poorly named and surprising.

Steps to Reproduce:
1. Add a UICollectionViewController called myCollectionViewController
2. Create a new collection view layout
3. change the (collection view controller’s) collection view’s layout

Expected Results:
Expect myCollectionViewController.collectionViewLayout to point to the new layout

Actual Results:
myCollectionViewController.collectionViewLayout points to the original layout, even though it no longer exists.

Regression:
present since api added in 7.0

Notes:
Documentation for the property explains this: “This property contains the layout object you passed to the initWithCollectionViewLayout: method. The layout object in this property is not updated to reflect changes to the collection view itself. You can use this property to refer to the layout object you originally configured the collection view to use.” However this is not what the name indicates. The property should be called “initialCollectionViewLayout” - or it should always ask the collection view for the current layout. A colleague lost some hours to trying to troubleshoot unexpected layout behavior, until we stumbled on this documentation after noticing that the layout returned was not the layout we expected.

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!