Getting a white space at bottom of iPhone X screen (Xcode 9)
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?
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.
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".
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)