Scroll View's height take the device's height

Hi, I'm new to Swift and I'm creating an app where I fetch movies from an api and then show it on screen when selected.

The content is dynamic and sometimes the description of the movie is bigger than the devices height. I created a Scroll View > View > View Stack > Header View, Information View, Description View.

The Heather View and Information View have both static height, however, the Description View is where the movie description will be populated. When it is populated and it's too long, you can scroll the screen and while the finger is on the phone you can see the rest of the text, but when the finger is removed, it goes to the initial position.

I have no idea what I'm missing.
Any help? I have a video of the experience but I'm not being able to copy it in the question.

Thanks,
Answered by OOPer in 672204022
OK, I have copied the xml code into the source of the Main.storyboard of the test project.
Xcode said it fixed some parts, but I think I have found the cause of the issue.

Simply saying, the constraints are sort of broken.

When you put a single view as the only content view of a UIScrollView, you connect the four edges of the view to the Content Layout Guide of the UIScrollView, and some other things to define horizontal position, usually width.

And the content of the view need to define the height. You have not added enough constraints to define the height of Description view.

The two things making the scroll view content to a fixed position and you can move it only in the margins of bounce scrolling.

Not sure what sort of constraints you were trying to add, so it's hard to tell how to fix.
So this is just an example which I could make the scroll view scroll:
Code Block
    ∨□Scroll View
      □Content Layout Guide
      □Frame Layout Guide
     ∨□View
       >□Header
       >□Information
       ∨□Description
         □Movie Description
        >□Reviews
        ∨□Constraints
          □Movie Description.top = top + 10
          □trailing = Movie Description.trailing + 20
          □Movie Description.leading = leading + 10
          □bottom = Reviews.bottom + 109.5
          □Reviews.centerX = centerX
          □Movie Description.top = top + 10
          □Reviews.top = Movie Description.bottom + 15
       >□Constraints
      >□Constraints
     ∨□Constraints
       □View.leading = Content Layout Guide.leading
       □View.bottom = Content Layout Guide.bottom
       □View.width = width
       □View.top = Content Layout Guide.top
       □View.trailing = Content Layout Guide.trailing

Hope you can understand this and make the right layout for you.
Sorry but it's not clear enough. Are you using ScrollView of SwiftUI or UIScrollView of UIKit? Or something else?
Can you show the complete code which can reproduce the issue?
Sure OOPer! I'm using UIScrollView of UIKit.

I actually did all of it on the Main Storyboard, so not sure how to provide any code. Is there a way to send images o videos through here? It would be waay clear.

Here's the ViewController source code if it's of any help:



Thanks,
Thanks for clarifying and showing the xml of your MovieViewController.
Unfortunately, I do not know much about how to utilized the partial xml.

Anyway, I will tell you when I find some clue to solve the issue.
Accepted Answer
OK, I have copied the xml code into the source of the Main.storyboard of the test project.
Xcode said it fixed some parts, but I think I have found the cause of the issue.

Simply saying, the constraints are sort of broken.

When you put a single view as the only content view of a UIScrollView, you connect the four edges of the view to the Content Layout Guide of the UIScrollView, and some other things to define horizontal position, usually width.

And the content of the view need to define the height. You have not added enough constraints to define the height of Description view.

The two things making the scroll view content to a fixed position and you can move it only in the margins of bounce scrolling.

Not sure what sort of constraints you were trying to add, so it's hard to tell how to fix.
So this is just an example which I could make the scroll view scroll:
Code Block
    ∨□Scroll View
      □Content Layout Guide
      □Frame Layout Guide
     ∨□View
       >□Header
       >□Information
       ∨□Description
         □Movie Description
        >□Reviews
        ∨□Constraints
          □Movie Description.top = top + 10
          □trailing = Movie Description.trailing + 20
          □Movie Description.leading = leading + 10
          □bottom = Reviews.bottom + 109.5
          □Reviews.centerX = centerX
          □Movie Description.top = top + 10
          □Reviews.top = Movie Description.bottom + 15
       >□Constraints
      >□Constraints
     ∨□Constraints
       □View.leading = Content Layout Guide.leading
       □View.bottom = Content Layout Guide.bottom
       □View.width = width
       □View.top = Content Layout Guide.top
       □View.trailing = Content Layout Guide.trailing

Hope you can understand this and make the right layout for you.
I can not believe it! It worked perfectly. I've been struggling with this for the past three days and I wasn't able to find a solution. Thank you so much!!
Scroll View's height take the device's height
 
 
Q