即使我使用的是安全区域,iPhone X 的启动屏幕底部仍有一个空白区域。
在界面生成器上似乎没问题:
我正在使用 superview 作为我的约束:
这是视图层次结构:
我怎样才能摆脱它?
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.
Same applies to the launch screen controller.
If you have the constraint already added. you can change that from the constraint Attributes Inspector:
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