Reputation: 33901
I have a UIScrollView
that contains everything else in my ViewController
. I use it because I have logic to scroll up the view when the keyboard shows.
I'm working to make my view compatible with variable screen sizes to accommodate newer iPhones. Currently there are no constraints on anything in the ViewController
. If I open the app on a device, it appears in the top left corner.
The first thing I tried was pinning the left/right sides of the UIScrollView to the edges of the container, with left/right distances of 0. When I fired it up on a device, the view had disappeared entirely.
I then tried adding a Horizontal center in container
constraint the scrollview (removing the other constraints). Again, just a blank screen - everything had disappeared.
What am I doing wrong? How do I make my scrollview fill the screen, or at least be centered on wider devices?
Is there any way to debug layout issues like this? At the moment, I have no insight into what has happened to the view.
Upvotes: 1
Views: 371
Reputation: 33901
Adding height/width constraints, even though these constraints were overridden to stretch the view to the viewport, fixed this problem.
Upvotes: 2