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.

Share:
64,398
Madu
Author by

Madu

Updated on July 24, 2022

Comments

  • Madu
    Madu almost 2 years

    I am making a very basic UIScrollView test. Here is my setup enter image description here It shows me the following AutoLayout error:

    ScrollView has ambiguous scrollable content height 
    
  • Abdul Yasin
    Abdul Yasin about 9 years
    I have given a height to the scrollview. Will it work? Or do i need to add bottom guide as well ?
  • Sandy Chapman
    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
    Developer over 8 years
    But then how scrollView will scroll if we set if frame equal to its contentsize??
  • Sandy Chapman
    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.