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

Originator:futuretap
Number:rdar://36176614 Date Originated:21-Dez.-2017 02:12 PM
Status:Duplicate/33316167/Open Resolved:
Product:iOS + SDK Product Version:11.0b3
Classification:Enhancement Reproducible:Always
 
Summary:
[This is a duplicate of radar #33316167. In our case, the collection view is embedded in a table view for various reasons. Our workaround is to embed both views into a common container and sync the contentOffsets of collection and table views. That achieves the appearance of the collection view being a subview of the table view even though they're siblings. Ugly but being aggressive in cell reuse makes a huge difference, especially in this our case (collection view cells are photo thumbnails). We really would prefer to embed the collection view into a self-sizing table view cell instead!]

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.

Version:
11.0b3

Notes:

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!