ScrollView has ambiguous scrollable content height
64,398
You need to ensure you've got a chain of vertical spacing constraints from the top of the scroll view through all your elements to the bottom of the scroll view.
Once you do that, your warning/error should go away.
Author by
Madu
Updated on July 24, 2022Comments
-
Madu almost 2 years
I am making a very basic UIScrollView test. Here is my setup It shows me the following AutoLayout error:
ScrollView has ambiguous scrollable content height
-
Abdul Yasin about 9 yearsI have given a height to the scrollview. Will it work? Or do i need to add bottom guide as well ?
-
Sandy Chapman about 9 years@AbdulYasin, no, you need the content within the scrollview to have a defined height as well. The height of the content in the scrollview can be larger or smaller than the height of the scrollview itself.
-
Developer over 8 yearsBut then how scrollView will scroll if we set if frame equal to its contentsize??
-
Sandy Chapman over 8 years@Developer the scrollview's frame does not equal the size of the scrollview's content. If they were equal, then the scrollview would never scroll.