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
Asked
Active
Viewed 1.3k times
2
-
@zemoon how you show image through url – veerendra pratap singh Feb 17 '18 at 07:14
-
You should be able to do so after 10 reputation. – ZeMoon Feb 17 '18 at 07:28
-
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. – Sagar Chauhan Feb 17 '18 at 07:30
-
https://stackoverflow.com/questions/38948904/calculating-contentsize-for-uiscrollview-when-using-auto-layout/38969007 – Amit Feb 17 '18 at 07:44
1 Answers
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.

LGP
- 4,135
- 1
- 22
- 34
-
-
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
-
1This 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