问题
I'm using Xcode 9 for my project and I'm getting a white space at the bottom, here is the screenshot:

Also I'm using storyboard to design with 4 inches (iphone 5s/SE) as layout.
How to avoid the white space?
回答1:
Your bottom constraints
should be from view
not from the bottom layout guide
or safe area
(xcode 9 specific) and your distance should be zero.
Default it was pinned with layout guides
, so give it with view
!
Refer below screenshot for better understanding,
to open this dialogue, click drop down icon of field contains 0
!
You can do same for top constraint
also!
Update :
Second main important thing,
you should use storyboard for your launch or splashscreen. If you are using launch image then replace it by new launch image of xcode 9
and it have option for the image of iphone x.
Then you will not found white space any more!
Refer below screenshot.
回答2:
This white space is your main view. If you want your image view to fill the whole area, pin it with 0 space to the superview, not to Bottom Layout Guide or Safe Area. To achieve this, select to view scene in storyboard as iPhone X and pin the image view as below:
It is also possible to pin the bottom of image view to superview when not in iPhone X mode: when you pin by dragging with Ctrl, when the list of constaints appears press Option key (alt) and you will see "Bottom Space to Container Margin".
回答3:
Neither of the two answers above worked for me. Only setting
scrollView.contentInsetAdjustmentBehavior = .never
I have a stackView inside my scrollView and the elements in the stackView have fixed sizes, so I have no need to inset adjustment and this works.
Credit goes to How to get rid of safeAreaInsets on UIScrollview (iOS 11, iPhoneX)
回答4:
For me this worked:
1) Select image for which you are setting up constraints
2) Go to Attribute inspector in the right panel
3) Select Scale to Fill
as Content Mode
来源:https://stackoverflow.com/questions/46322150/getting-a-white-space-at-bottom-of-iphone-x-screen-xcode-9