Setting UICollectionViewFlowLayout's properties not working when using Auto Layout
| Originator: | me | ||
| Number: | rdar://22454003 | Date Originated: | Setting UICollectionViewFlowLayout's properties not working when using Auto Layout |
| Status: | Open | Resolved: | |
| Product: | iOS | Product Version: | iOS 7 - ... |
| Classification: | Reproducible: | Always |
Summary: Settings the properties of an UICollectionViewFlowLayout in viewDidLayoutSubviews() does nothing. Even after calling invalidateLayout() of layoutIfNeeded(), the old values are still being used when displaying the UICollectionView. Steps to Reproduce: 1. Run the sample project 2. Rotate the device 3. Note how the minimum line spacing is not correct even though it's set correctly in viewDidLayoutSubview() 4. Tap on a cell to manually trigger a layout invalidation 5. The layout is now correct Expected Results: The minimum line spacing set in viewDidLayoutSubviews() should be respected after the rotation has completed. Actual Results: The minimum line spacing is completely ignored and is only respected if we call collectionViewFlowLayout.invalidateLayout() again at a later point (e.g. a button click). Version: iOS 7 - ... Notes: I included a boolean flag useAutoLayout in viewDidLoad to indicate how the issue only pops up when using Auto Layout. The example project uses the minimumLineSpacing to indicate the issue but other properties (e.g. itemSize) aren't working as well. Configuration: All Simulators and Devices. Attachments: 'Test.zip' was successfully uploaded.
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!