WWDC在2019有session提出。到2020年4月,上架APP的启动页必须使用launchscreen.storyboard,不能再使用assert方式了,launchscreen.storyboard比较简单,但是适配有白边的问题很苦恼。接下来说一下怎么消除白边。
1、选中LaunchScreen.storyboard,勾选Use as Launch Screen的选项,注意此时不要取消Use Safe Area Layout Guides选项。(尽管你的项目适配iOS9.0以下会报错,先不要管,如果取消了在后面布局设置中左右会有20像素的留白)

2、添加UIImageView控件

3、为新添加的UIImageView

4、选中上下左右的约束(点击短横线),并将数值都设为0,最后点击下面的Add按钮,如下图所示:

5、此时选中带刘海屏的手机模型,你会发现上下还是有留白
6、解决留白问题,在左窗口选中底部约束—>点击右侧的First item—>选择Superview—>将Constant设置为0,如下图所示:

修改完的效果如下图所示:

同样的方式,修改顶部约束:注意此时需要将 Second item—>选择Superview
网友评论