2

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

ZeMoon
  • 20,054
  • 5
  • 57
  • 98

1 Answers1

15

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

LGP
  • 4,135
  • 1
  • 22
  • 34
  • I have done this but its showing me again same error – veerendra pratap singh Feb 17 '18 at 09:19
  • 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. – LGP Feb 17 '18 at 09:25
  • 1
    This worked for me, and in fact is the solution implemented by Xcode when you ask it to add constraints to fix the "problem". – Andrew Duncan Oct 30 '18 at 21:00