Reputation: 167
I have a viewController
with some text and under it a UICollectionView
(about 50% of the page).
My problem is that when I scroll on the collectionView
just the cells are being scrolled and not the whole page (the text + the collection cells).
You can think about it like on Instagram profile page (half info half collectionView
), when you scroll on Instagram everything is being scrolled and not just the collection cells.
Anyone knows how can I do it?
Thanks!
Upvotes: 0
Views: 867
Reputation: 2246
Thats because your text/UILabels
doesn't belong within the UIScrollView
of your UICollectionView
, thus it will not be scrolled when the collectionView
is. You could create a UICollectionViewCell
for your text, include it within your collectionview
and expand the collectionView
to fit the screen or use a UICollectionViewController
Upvotes: 0
Reputation: 35
Add the text content as separate cells on top of the UICollectionView.
Preferably, create a different section which would contain the cells with the top text.
Keep the backgroundColor/backgroundImage of these cells plain to give the effect that they are simply added as UILabels on a form. Doing so will also differentiate from the rest of the actual UICollectionViewCells.
Now, when you scroll the UICollectionView. It will give an effect that the text along with the cells are scrolled.
Upvotes: 1