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,
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,
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:
Hope you can understand this and make the right layout for you.
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.