Search code examples
iosswiftuiscrollviewcrop

UIScrollView Content of the view is cropped


Hi I'm trying to implement a vertical ScrollView, I do it with the StoryBoard, my View Controller is containing a Scroll View which is containing a View (with the content inside):

https://i.sstatic.net/VJAb2.png

When I start my apps the content is cropped, but it's not cropped when I'm editing my storyboard:

https://i.sstatic.net/RI3yo.png


Solution

  • Center the chidld view in the scroll view, make sure you correctly pin your scrollView

    choose:

    • add a proportionnal constaint between your view and the firstview
    • Or add a trailling and a leading constraint to the scrollView

    NB: use preview view. Select before your storyboard. This feature help to to see automatic render of your view. You will debug quicly you problem.

    enter image description here