scrollview has ambiguous scrollable content height & Width

11,391

Scroll views are special when you set constraints. Because they have an undefined content size you must set constraints for both its contents' sizes and edges. Setting only top, bottom, left, right is not enough, also set height and width.

Try this. Add a single UIView to an otherwise empty scroll view. Then tie the edges of the view to the scroll view. Finally set the height and width to fixed size.

Read more

Share:
11,391
veerendra pratap singh
Author by

veerendra pratap singh

Updated on June 05, 2022

Comments

  • veerendra pratap singh
    veerendra pratap singh about 2 years

    How Can i solve it. I try all type of constraints like top, bottom, left , right, horizontally, vertically, also equal height and width plz see the link below for image

    • veerendra pratap singh
      veerendra pratap singh over 6 years
      @zemoon how you show image through url
    • ZeMoon
      ZeMoon over 6 years
      You should be able to do so after 10 reputation.
    • Sagar Chauhan
      Sagar Chauhan over 6 years
      Please show Storyboard ViewController image. So People can give you more precise solution. Also one more thing, you have added Page Control Inside Scroll View, but there are also need to add content View and then add page control.
    • Amit
      Amit over 6 years
  • veerendra pratap singh
    veerendra pratap singh over 6 years
    I have done this but its showing me again same error
  • LGP
    LGP over 6 years
    Are you sure you tied all edges and set the height and width? Did you also have only one view inside your scroll view? Was the error from this scroll view, as you seem to have several scroll views in your design.
  • Andrew Duncan
    Andrew Duncan over 5 years
    This worked for me, and in fact is the solution implemented by Xcode when you ask it to add constraints to fix the "problem".