0

I have the following structure:

- Scroll view
    - UIView
        - Collection view

I gave the UIView the following constraints:

  1. top, left, right, and bottom = 0
  2. Equal width and height to the Scroll view

I've also disabled scrolling for the Collection view, as I want the whole page to scroll together.

However, when items are added (dynamically) to the collection view and I try to scroll, nothing happens.

What am I doing wrong? How can I make sure that the page scrolls all together?

user86516512
  • 445
  • 4
  • 13

1 Answers1

0

Maybe you should try removing the equal heights between view and scroll view because this limits view's height and doesn't allow collection view to grow.

rickramirr
  • 19
  • 3
  • If I do that, I get the following error on the scroll view: `Need constraints for: Y position or height` – user86516512 Jun 10 '21 at 00:02
  • The constraints in my question are the only constraints I have – user86516512 Jun 10 '21 at 00:14
  • 1
    I just remember that collection doesn't grows dynamically to content height, i recommend you this [thread](https://stackoverflow.com/questions/42437966/how-to-adjust-height-of-uicollectionview-to-be-the-height-of-the-content-size-of) – rickramirr Jun 10 '21 at 01:17