项目建立的时候删除了Launch Screen.storyboard,苹果通知2020年4月之后,要使用Launch Screen.storyboard。所以这篇文章介绍如何往项目中添加Launch Screen.storyboard的情况。
New File添加Launch Screen.storyboard,如图1

添加成功后,配置项目相关信息,如图2(注意写法),图3(去掉勾选)


另外在删除Assets.xcassets下Launch Image后报错None of the input catalogs contained a matching launch image set named LaunchImage,解决方案如下图4

在Launch Screen.storyboard中的view下添加一个image view,设置约束,并注意约束是相对于view的各个边距为0。否则不会铺满整个屏幕。同时设置图片的拉伸方式,见下图5,图6


image view需要显示的图片最好不要放在Assets.xcassets下,放到项目跟目录下,然后就可以运行试试啦~
如果项目启动还是不显示图片可参考
网友评论