UICollectionViewLayout not updated on split view size change

Originator:hotngui
Number:rdar://41980171 Date Originated:07/09/2018
Status:Open Resolved:
Product:iOS Product Version:11.4
Classification:UI/Usability Reproducible:YES
 
Summary:
The UIVCollectionViewLayout method "targetContentOffset(forProposedContentOffset:)" does not get called when the layout is invalidated in all cases. Specifically, if on an iPad Pro the use is in Landscape mode and they manually change the sizes from say 1/3 to 2/3 one expect the forementioned method to be called. If I take the same scenario, but rotate the device instead then indeed the method gets called correctly.

My custom layout basically just attempts to settle the scrolling such as to leave a cell centered on the screen, showing a little of the previous and next cells accordingly. When the bounds of the UICollectionView changes I directly invalidate the layout.

Steps to Reproduce:
Unzip, build and run the attached project. Configure the iPad as landscape mode and set the split at 2/3. Then scroll the collection view a couple of times and observe how it settles with one of the cells centered in the collection view. Then manually change the split to 1/3 and notice that the collection view cell is no longer centered, but manually scrolling it will once again result in a cell be centered. You can repeat the scenario, but rotate the device instead and see it working correctly.

A well placed breakpoint shows that in the bad case the method in question does not get called, but in the rotation case it does as expected.

Expected Results:
"targetContentOffset(forProposedContentOffset:)" should be called so we can correctly adjust the contentOffset.

Actual Results:
"targetContentOffset(forProposedContentOffset:)" is not being called

Version/Build:
SDK 11.4, Xcode 9.4.1
SDK 12.0 Beta, Xcode 10 Beta 3

Configuration:

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!