UICollectionView should provide a way to derive the visible bounds from a containing scroll view

Number:rdar://33316167 Date Originated:14-Jul-2017 04:49 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:11.0b3
Classification:Enhancement Reproducible:Always
UICollectionView offers a great way to build all sorts of custom layouts while at the same time being very memory and performance efficient by only loading the cells that are actually visible on screen.

There is one scenario where all this awesomeness goes south, though: When you need to embed a collection view in a scroll view (e.g. to be able to zoom a collection view) the collection view always loads all cells because its size is equal to the containing scroll view’s content size.

There should be support for this kind of scenario from UIKit.

Steps to Reproduce:
0. Open the attached sample
1. Check out ViewController

Expected Results:
The locations marked with FIXME should work the way I noted it there.

Actual Results:
There is a quite ugly work around required to get it working which has the caveat to break flow layout as well as cell prefetching.




Sample Code


By michaelhochs at July 14, 2017, 2:53 p.m. (reply...)

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!