CollectionView inside ScrollView

From the information in the question it's hard to give a detailed answer. Just a little tip. You should carefully check 2 important things, when your are working with UIScrollView:

  1. Autolayout constraints of scroll view subviews.
  2. contentSize of your scroll view.

Maybe this will help.

There are also some tips even you choose to disable scrollable for uicollectionView:

  1. You need a fix height for uicollectionView in autolayout, or that will give you a warning: scrollview need y position or height.
  2. You need a constraint outlet to collectionView's height, and adjust its value to contentSize in your code. Such as in viewDidLoad. That means you cannot implement this only using AutoLayout.

It's not considered good practice to put an UICollectionView inside a UIScrollView because this will result in some unwanted behavior since UICollectionView is a descendant of the UIScrollView class.

Instead of having a UIScrollView with Label, Image, Label, CollectionView, you could remove the UIScrollView and add a UICollectionReusableView as a header to the UICollectionView. Inside this header you can put the Label, Image, Label and that view will always stay on top of the UICollectionView section you created the header for.

You could have a go at this and then come back to us if you run in to some problems :)

UICollectionView

Collection View Basics

Tags:

Ios

Swift

Swift3