I think the gap you see is caused by the navigation bar. The gap is equal to size 64, the size of which is the navigation bar + status bar (44 + 20). You need to limit the scrollbar to the top layout guide. Pressing this 64 is negative. So your constrolant scrollview will be -64.
This can also be done with one click by clicking the position view button in the size inspector in xcode.
Click on the position view and select the container to store vertically . This will limit the scroll guide in the top layout. Now select scrollview and click on the update restrictions in the storyboard.

As you can see, the contentView is not designed to cover the view just like a scrollview, there is a place on the content view button when the view is loaded, the navigation bar will take up additional space, and the content image will be exactly where you need it.
source share