Search code examples
iosswiftios-simulator

Zoomed screen with any other iPhone simulator other than iPhone 11


I am trying to test and refine the application I've been working on lately and I found that it looks as it should with the iPhone 11 simulator, but with any other iPhone (smaller/bigger screen) it seems to zoom the screen even if every item from the ContentView has a Leading/Trailing constraint to Superview = 20. It's zooming right until the appearance of the items and right until their horizontal end (labels, textfields, ...).

It seems to zoom, not cut, because besides the up-down scroll bar, now I am able to scroll left-right.

Here is the stack of the embedded views of the UIViewController with their constraints.enter image description here

The constraints for ContentView are Bottom to Superview = -70 / Top to Superview = 0 / Leading and Trailing to Superview = 0.

Xcode version used: 13.4.1


Solution

  • @DonMag's solution in the comments worked for me:

    You should constrain your ContentView top/leading/trailing/bottom to the scroll view's Content Layout Guide... and constrain its width to the scroll view's Frame Layout Guide. Right now, I'm assuming the content view's subviews are determining its width.