4

即使我使用的是安全区域,iPhone X 的启动屏幕底部仍有一个空白区域。

底部的空白区域

在界面生成器上似乎没问题:

在界面构建器上

我正在使用 superview 作为我的约束:

约束

这是视图层次结构:

查看层次结构

我怎样才能摆脱它?

4

3 回答 3

4

The white space you see is the controller default view background color.

The problem is when you try to add a top/bottom constraint to any view. It adds the constraint to the Layout Guide (default behavior).

To over-write that. you can click the arrow next to the constrait constant value. which shows the views that you can connect against. obviously you need to connect with the one with the largest distance value, and set the constant value to 0.

enter image description here

Same applies to the launch screen controller.

If you have the constraint already added. you can change that from the constraint Attributes Inspector:

enter image description here

If you have a top constraint you need to choose the First Baseline. and if you have a bottom constraint you need to choose Last Baseline

于 2017-10-04T20:45:32.610 回答
0

If Using LaunchScreen then do the following

first setup LaunchImage with proper size and reference to correct assest.

Remove Launch screen File or set nil enter image description here

于 2019-05-14T13:22:29.487 回答
0

这刚刚解决了我的问题!尝试选择 SuperView 选项,如屏幕截图所示。我在屏幕顶部也遇到了同样的问题,我做了同样的程序,并且成功了!

XCode 截图

于 2022-02-25T16:17:54.090 回答