F.SO4
F.SO4

Reputation: 167

UICollectionView scroll whole page

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

Answers (3)

Hiep Pham
Hiep Pham

Reputation: 61

In Attribute inspector > Scroll View > check Paging enable

Upvotes: 1

kye
kye

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

Sam Gayle
Sam Gayle

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

Related Questions