How to use CollectionView inside a ScrollView

Hi,


I'm trying to achive something like this


. View
.. Scrollview
... Label1
... Label2
... Label3
... Label4
... Label5
... CollectionView
.... Cell
..... Content View
...... Label 1
...... 
...... Label n


So the problem is scrollview is working fine and i'm able to pass the data on Label 1, Label 2, Label 3, Label 4, Label 5. But collection view is not being displayed. The method which i'm trying out is it correct or is there an alternative way to implement ?


Thanks

Answered by Claude31 in 422007022

CollectionView is itself a scrollView.

So you want to include a scrollView inside another scrollView.

That may lead to undesired behavior and complexity for user to use it properly.


You should probably reorganize your hierarchy and use headers or supplementary views.


Here is an old thread dealing with this question:

https://stackoverflow.com/questions/47173792/collectionview-inside-scrollview

Accepted Answer

CollectionView is itself a scrollView.

So you want to include a scrollView inside another scrollView.

That may lead to undesired behavior and complexity for user to use it properly.


You should probably reorganize your hierarchy and use headers or supplementary views.


Here is an old thread dealing with this question:

https://stackoverflow.com/questions/47173792/collectionview-inside-scrollview

How to use CollectionView inside a ScrollView
 
 
Q